KXUP7U3ZFWLTVAQIZXVR5I4RXS4SNTNPTPHFCKD6WNI75J7KY7GQC
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw
use std::collections::HashSet;
pub enum Errors {
}
pub struct Group {
pub rucksacks: [Rucksack; 3]
}
impl Group{
pub fn create(content: [String; 3]) -> Group {
let rucksacks: [Rucksack; 3] = content.iter().map(|contents| Rucksack::create(contents.as_str())).collect::<Vec<Rucksack>>().try_into().unwrap();
Group{rucksacks}
}
pub fn get_intersection(&self) -> char {
let [r1, r2, r3] = &self.rucksacks;
let r1_set = r1.to_set();
let r2_set = r2.to_set();
let mut intersection = r1_set.intersection(&r2_set);
*intersection.find(|character| r3.contains(**character)).unwrap()
}
}
#[derive(Debug)]
pub struct Rucksack {
pub content: String,
}
impl Rucksack {
pub fn create(content: &str) -> Rucksack {
Rucksack{content: String::from(content)}
}
pub fn contains(&self, character: char) -> bool {
self.content.contains(character)
}
pub fn to_set(&self) -> HashSet<char> {
self.content.chars().collect()
}
}
#![feature(iter_array_chunks)]
extern crate clap;
use clap::{Arg, Command};
mod types;
use types::{Errors, Group};
use std::io::{self, BufRead, BufReader, Lines, Error};
use std::fs::File;
use std::path::Path;
fn read_testcase<P>(filename: P) -> io::Result<Vec<Group>>
where P: AsRef<Path> {
let file = File::open(filename)?;
parse_testcase(BufReader::new(file).lines())
}
fn parse_testcase(content: Lines<BufReader<File>>) -> Result<Vec<Group>, Error> {
Ok(content
.array_chunks()
.map(|[line1, line2, line3]| [line1.unwrap(), line2.unwrap(), line3.unwrap()])
.map(|lines: [String; 3]| Group::create(lines))
.collect()
)
}
fn solve(test_case: Vec<Group>) -> Result<u32, Errors> {
Ok(
test_case
.iter()
.map(|group| group.get_intersection())
.map(|character| get_priority(&character))
.fold(0, |acc, priority| acc + priority)
)
}
fn get_priority(character: &char) -> u32 {
match character {
a if a.is_ascii_lowercase() => *a as u32 - 96,
a if a.is_ascii_uppercase() => *a as u32 - 38,
_ => panic!()
}
}
fn print_solution(result: Result<u32, Errors>) {
match result {
Ok(solution) => print!("{}\n", solution),
Err(_) => print!("Error solving for provided test case")
};
}
fn main() {
let matches = Command::new("Advent of Code")
.version("1.0")
.author("Salvador P. <sisekeom@protonmail.com>")
.about("Solution for advent of code 2022 3.1")
.arg(Arg::new("filepath")
.help("path to the test case file")
.required(true)
.index(1))
.get_matches();
let filepath = matches.get_one::<String>("filepath").unwrap();
read_testcase(filepath).map(solve).map(print_solution).unwrap();
}
fzmmmfwDWFzlQQqjCQjDGnqq
tJHJvLJVVttNsvTtTvgHHSVwCsQRQQZCZZMqQMQBnqBMQs
LgThNJhNSgTJVgvgtghPhbpfWzfbwfPmpprb
lDLnSnLZRjmWrlhrFF
PffQJNqJbPZbpmjrrCVNFmCh
qzbcbqfMfZMTfQTqqzzTPPLMHgBBBtHRStvgHRDBnSRL
WPZfJlZZCMwwZPWCwWzVHQhsshVSsfNQHdvQNN
FLGDGGnGdVjQQQDQ
ccFFbggLnRcLFRtFBmnJzdZZzZBMpwJlZMppMp
RZsnCZssCnDccJCnfcQfHTdzMzhdLdMTqdRqpRLwqq
tNrGNrrvGhTThQqw
rrFStPgrFWWgvmPgQjtmNtmJcfJcsJsZblDZfbfHDFHnfl
RdTfgbbPbJWDDqRvsDsmVG
NSQZLQZHpFGLqnLszrJm
ZMSNMHhNZMMSQwhQJWPBJCbhbcgtgfcJ
qZfqPvLnnZGpGpCJlvsMsMlHJJHB
mTWFFFTTtVSJMzzjWgSH
RbVdtdFtcrmbRQDDVHDQTbDNwLPLfnqZnhZhQnNwfNqnnn
nhHfSGHGThhZjnhrrSnsSczdzlfzzdQQVzRNFNcFdl
JJvCDvmCbtvpvbMmDvLbCJpmqdVVVcMcNGzRcNFcRRzRclQd
vwDCwtLmwLBDJmCHHjH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pchLppdccTNtZZTRRPSSnwPPSbSnhhrhnSJ
qfqsFsqffgQMznJrPznbMrrB
vglfqQCgDgFjglCDCjLZpTHNPHttdcZVVN
FWtDHDStZwrFCDwrgWPFDsWQJZzlMdpZzlNpNjdjjQzNzj
BqnVGVcbTmGfHLGVzvpQpvJvQlflMdJp
ThRRchnHqLTGbFCCCrrSSFhFCs
wJrwdZPnJwqPbJPCnjFZdvHtMvsLsTsDtHsHDDqvpH
RWzNRWjRfgjNMMLvcMcLNt
WGGRQzzRmRmVQSgwrwJjjCbJhnbShJ
cjngcvcwbMwWnbMWjbgvnsjPftsqfthqsBtsJJJJBt
HrGFmDDzpmLTHpDsPfsBNBPfzZNPqN
DDVmDplDrpGSVSTTHGlpLnPwCRnWcvWCdPbbMvcVdW
BVRlBfPBffWswVWQsfwBNNPMFMmmGFZGnWZGtztrzMZMnz
HqSJchHTHbTgHhGhvmRzFmnFtzRF
RJqHTpgDLJDSqLJJPNVjsfPwBVsVLlfN
NDrBlSmrFBlbbJllmtHHwhNNhZztqHVRzQ
CMTCGLcvvtfCdCcCvCnMTMcTzjHwVZVRLjRRjQjRHRwzwjVH
dfGdgGMGPggnvfvgbtDtlSJPDSFJPslJ
[package]
name = "advent"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = "4.0"
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advent"
version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]]
name = "clap"
version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [
"bitflags",
"clap_lex",
"is-terminal",
"strsim",
"termcolor",
]
[[package]]
name = "clap_lex"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "libc"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "rustix"
version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
/target
AA
use std::collections::HashSet;
pub enum Errors {
}
pub struct Rucksack {
pub first: String,
pub second: String
}
impl Rucksack {
pub fn create(content: &str) -> Rucksack {
let (first, second) = content.split_at(content.chars().count() / 2);
let first = String::from(first);
let second = String::from(second);
Rucksack{first, second}
}
pub fn to_sets(&self) -> [HashSet<char>;2] {
[
self.first.chars().collect(),
self.second.chars().collect()
]
}
}
extern crate clap;
use clap::{Arg, Command};
mod types;
use types::{Errors, Rucksack};
use std::io::{self, BufRead, BufReader, Lines, Error};
use std::fs::File;
use std::path::Path;
fn read_testcase<P>(filename: P) -> io::Result<Vec<Rucksack>>
where P: AsRef<Path> {
let file = File::open(filename)?;
parse_testcase(BufReader::new(file).lines())
}
fn parse_testcase(content: Lines<BufReader<File>>) -> Result<Vec<Rucksack>, Error> {
Ok(content
.map(|line| Rucksack::create(&line.unwrap()))
.collect()
)
}
fn solve(test_case: Vec<Rucksack>) -> Result<u32, Errors> {
Ok(test_case.iter()
.map(|rucksack| {
let [first, second] = rucksack
.to_sets();
let character = first.intersection(&second).next().unwrap();
get_priority(character)
})
.fold(0, |acc, priority| acc + priority))
}
fn get_priority(character: &char) -> u32 {
match character {
a if a.is_ascii_lowercase() => *a as u32 - 96,
a if a.is_ascii_uppercase() => *a as u32 - 38,
_ => panic!()
}
}
fn print_solution(result: Result<u32, Errors>) {
match result {
Ok(solution) => print!("{}\n", solution),
Err(_) => print!("Error solving for provided test case")
};
}
fn main() {
let matches = Command::new("Advent of Code")
.version("1.0")
.author("Salvador P. <sisekeom@protonmail.com>")
.about("Solution for advent of code 2022 3.1")
.arg(Arg::new("filepath")
.help("path to the test case file")
.required(true)
.index(1))
.get_matches();
let filepath = matches.get_one::<String>("filepath").unwrap();
read_testcase(filepath).map(solve).map(print_solution).unwrap();
}
fzmmmfwDWFzlQQqjCQjDGnqq
tJHJvLJVVttNsvTtTvgHHSVwCsQRQQZCZZMqQMQBnqBMQs
LgThNJhNSgTJVgvgtghPhbpfWzfbwfPmpprb
lDLnSnLZRjmWrlhrFF
PffQJNqJbPZbpmjrrCVNFmCh
qzbcbqfMfZMTfQTqqzzTPPLMHgBBBtHRStvgHRDBn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MTCGLcvvtfCdCcCvCnMTMcTzjHwVZVRLjRRjQjRHRwzwjVH
dfGdgGMGPggnvfvgbtDtlSJPDSFJPslJ
[package]
name = "advent"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = "4.0"
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advent"
version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]]
name = "clap"
version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [
"bitflags",
"clap_lex",
"is-terminal",
"strsim",
"termcolor",
]
[[package]]
name = "clap_lex"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "libc"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "rustix"
version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
/target