From 365fa13141f39329d9bfd20992b8022f9bf48fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:02:08 +0100 Subject: [PATCH 01/12] Use 2021 edition --- maker/Cargo.toml | 2 +- maze/Cargo.toml | 2 +- test/Cargo.toml | 2 +- test/src/lib.rs | 2 +- tools/Cargo.toml | 2 +- web/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maker/Cargo.toml b/maker/Cargo.toml index 341bea5..ae20b0d 100644 --- a/maker/Cargo.toml +++ b/maker/Cargo.toml @@ -2,7 +2,7 @@ name = "maze-maker" version = "3.0.0" authors = ["Moses Palmér "] -edition = "2018" +edition = "2021" [dependencies] maze = { path = "../maze" } diff --git a/maze/Cargo.toml b/maze/Cargo.toml index 0a771c3..ef8abeb 100644 --- a/maze/Cargo.toml +++ b/maze/Cargo.toml @@ -2,7 +2,7 @@ name = "maze" version = "3.0.0" authors = ["Moses Palmér "] -edition = "2018" +edition = "2021" [dependencies] rand = { version = "0.7", optional = true } diff --git a/test/Cargo.toml b/test/Cargo.toml index 86345ec..e48d2f0 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -2,7 +2,7 @@ name = "maze-test" version = "3.0.0" authors = ["Moses Palmér "] -edition = "2018" +edition = "2021" [lib] proc-macro = true diff --git a/test/src/lib.rs b/test/src/lib.rs index 98a26b8..6b29939 100644 --- a/test/src/lib.rs +++ b/test/src/lib.rs @@ -102,7 +102,7 @@ fn shapes(attr: TokenStream) -> HashSet { .flat_map(|tree| match tree { TokenTree::Ident(ref shape) => Some(shape.to_string()), TokenTree::Punct(ref punct) if punct.as_char() == ',' => None, - _ => panic!(format!("Unexpected token: {}", tree)), + _ => panic!("Unexpected token: {}", tree), }) .collect::>(); if shapes.is_empty() { diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 674e82d..fefc7ec 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -2,7 +2,7 @@ name = "maze-tools" version = "3.0.0" authors = ["Moses Palmér "] -edition = "2018" +edition = "2021" [dependencies] maze = { path = "../maze" } diff --git a/web/Cargo.toml b/web/Cargo.toml index a2d9ced..6e44207 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -2,7 +2,7 @@ name = "maze-web" version = "3.0.0" authors = ["Moses Palmér "] -edition = "2018" +edition = "2021" [dependencies] maze = { path = "../maze" } From a6fa787663d9c2f4d42e022a66cfda441f6e7714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:10:07 +0100 Subject: [PATCH 02/12] Do not unnecessarily create closures --- maker/src/types/break_post_processor.rs | 2 +- maker/src/types/heatmap_renderer.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maker/src/types/break_post_processor.rs b/maker/src/types/break_post_processor.rs index c8ddd39..d575d2c 100644 --- a/maker/src/types/break_post_processor.rs +++ b/maker/src/types/break_post_processor.rs @@ -26,7 +26,7 @@ impl FromStr for BreakPostProcessor { fn from_str(s: &str) -> Result { let mut parts = s.split(',').map(str::trim); let map_type = - parts.next().map(|p| HeatMapType::from_str(p)).unwrap()?; + parts.next().map(HeatMapType::from_str).unwrap()?; if let Some(part1) = parts.next() { if let Ok(count) = usize::from_str_radix(part1, 10) { diff --git a/maker/src/types/heatmap_renderer.rs b/maker/src/types/heatmap_renderer.rs index 57f124f..a9572c8 100644 --- a/maker/src/types/heatmap_renderer.rs +++ b/maker/src/types/heatmap_renderer.rs @@ -34,7 +34,7 @@ impl FromStr for HeatMapRenderer { fn from_str(s: &str) -> Result { let mut parts = s.split(',').map(str::trim); let map_type = - parts.next().map(|p| HeatMapType::from_str(p)).unwrap()?; + parts.next().map(HeatMapType::from_str).unwrap()?; if let Some(part1) = parts.next() { if let Some(part2) = parts.next() { From 4918811f46a5eeace7176ef231cf8e8431c91108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:10:40 +0100 Subject: [PATCH 03/12] Simplified range checks --- tools/src/image/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/src/image/mod.rs b/tools/src/image/mod.rs index 2b1f941..d2baa67 100644 --- a/tools/src/image/mod.rs +++ b/tools/src/image/mod.rs @@ -75,11 +75,11 @@ impl str::FromStr for Color { .skip(1) // Hex decode and create list .map(|c| { - if c >= b'0' && c <= b'9' { + if (b'0'..=b'9').contains(&c) { Some(c - b'0') - } else if c >= b'A' && c <= b'F' { + } else if (b'A'..=b'F').contains(&c) { Some(c - b'A' + 10) - } else if c >= b'a' && c <= b'f' { + } else if (b'a'..=b'f').contains(&c) { Some(c - b'a' + 10) } else { None From bf69ee023c172d65b02a75fdc66e6f985f79cf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:11:11 +0100 Subject: [PATCH 04/12] Removed unused uses --- web/src/types/seed.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/web/src/types/seed.rs b/web/src/types/seed.rs index 2e91a94..4677187 100644 --- a/web/src/types/seed.rs +++ b/web/src/types/seed.rs @@ -30,8 +30,6 @@ impl initialize::Randomizer for Seed { #[cfg(test)] mod tests { - use serde_urlencoded; - use super::*; #[test] From 66dde59ea50f2ebbeadf02f335552e5c9f62bcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:11:29 +0100 Subject: [PATCH 05/12] Removed unnecessary references --- web/src/types/seed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/types/seed.rs b/web/src/types/seed.rs index 4677187..ae5c906 100644 --- a/web/src/types/seed.rs +++ b/web/src/types/seed.rs @@ -38,7 +38,7 @@ mod tests { Seed { lfsr: initialize::LFSR::new(1234) }, - serde_urlencoded::from_str::>(&"seed=1234") + serde_urlencoded::from_str::>("seed=1234") .unwrap()[0] .1, ); From 52d5833b200a3746ee1d0bade3dcf19e0589bd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 21 Dec 2021 19:01:49 +0100 Subject: [PATCH 06/12] Do not use a lock file --- .gitignore | 3 + Cargo.lock | 2083 ---------------------------------------------------- 2 files changed, 3 insertions(+), 2083 deletions(-) delete mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 73d3a50..9b450ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ target +# This is a library +Cargo.lock + # Vim swap files *.swo *.swp diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 7bdfdf9..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2083 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "actix-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" -dependencies = [ - "bitflags", - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project", - "tokio", - "tokio-util", -] - -[[package]] -name = "actix-connect" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures-util", - "http", - "log", - "trust-dns-proto", - "trust-dns-resolver", -] - -[[package]] -name = "actix-http" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05dd80ba8f27c4a34357c07e338c8f5c38f8520e6d626ca1727d8fecc41b0cab" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt", - "actix-service", - "actix-threadpool", - "actix-utils", - "base64", - "bitflags", - "brotli2", - "bytes", - "cookie", - "copyless", - "derive_more", - "either", - "encoding_rs", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2", - "http", - "httparse", - "indexmap", - "itoa", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding", - "pin-project", - "rand", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "sha-1", - "slab", - "time", -] - -[[package]] -name = "actix-macros" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7a10ca4d94e8c8e7a87c5173aba1b97ba9a6563ca02b0e1cd23531093d3ec8" -dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", -] - -[[package]] -name = "actix-rt" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" -dependencies = [ - "actix-macros", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec", - "tokio", -] - -[[package]] -name = "actix-server" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "futures-channel", - "futures-util", - "log", - "mio", - "mio-uds", - "num_cpus", - "slab", - "socket2", -] - -[[package]] -name = "actix-service" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" -dependencies = [ - "futures-util", - "pin-project", -] - -[[package]] -name = "actix-testing" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" -dependencies = [ - "actix-macros", - "actix-rt", - "actix-server", - "actix-service", - "log", - "socket2", -] - -[[package]] -name = "actix-threadpool" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" -dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot", - "threadpool", -] - -[[package]] -name = "actix-tls" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "futures-util", -] - -[[package]] -name = "actix-utils" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "bitflags", - "bytes", - "either", - "futures-channel", - "futures-sink", - "futures-util", - "log", - "pin-project", - "slab", -] - -[[package]] -name = "actix-web" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36de80175eb1f0a5c518024ce0d23646b54a23008279e090ca1848f6f1448bf4" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes", - "derive_more", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "log", - "mime", - "pin-project", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "socket2", - "time", - "tinyvec", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "750ca8fb60bbdc79491991650ba5d2ae7cd75f3fc00ead51390cfe9efda0d4d8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "addr2line" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - -[[package]] -name = "async-trait" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "awc" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150e00c06683ab44c5f97d033950e5d87a7a042d06d77f5eecb443cbd23d0575" -dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "base64", - "bytes", - "derive_more", - "futures-core", - "log", - "mime", - "percent-encoding", - "rand", - "serde", - "serde_json", - "serde_urlencoded", -] - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide 0.4.2", - "object", - "rustc-demangle", -] - -[[package]] -name = "base-x" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "brotli-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "brotli2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -dependencies = [ - "brotli-sys", - "libc", -] - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "bytemuck" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - -[[package]] -name = "bytestring" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" -dependencies = [ - "bytes", -] - -[[package]] -name = "cc" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "clap" -version = "2.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[package]] -name = "color_quant" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" - -[[package]] -name = "const_fn" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" - -[[package]] -name = "cookie" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - -[[package]] -name = "copyless" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if", - "lazy_static", -] - -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - -[[package]] -name = "derive_more" -version = "0.99.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dcfabdab475c16a93d669dddfc393027803e347d09663f524447f642fbb84ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "dtoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "encoding_rs" -version = "0.8.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-as-inner" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "flate2" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" -dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "miniz_oxide 0.4.2", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" - -[[package]] -name = "futures-io" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" - -[[package]] -name = "futures-macro" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" - -[[package]] -name = "futures-task" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" -dependencies = [ - "once_cell", -] - -[[package]] -name = "futures-util" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gif" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" -dependencies = [ - "color_quant", - "lzw", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - -[[package]] -name = "h2" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" -dependencies = [ - "libc", -] - -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "idna" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "image" -version = "0.23.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "974e194911d1f7efe3cd8a8f9db3b767e43536327e899e8bc9a12ef5711b74d2" -dependencies = [ - "bytemuck", - "byteorder", - "gif", - "jpeg-decoder", - "num-iter", - "num-rational", - "num-traits", - "png", - "scoped_threadpool", - "tiff", -] - -[[package]] -name = "indexmap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2", - "widestring", - "winapi 0.3.9", - "winreg", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "jpeg-decoder" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3" -dependencies = [ - "byteorder", - "rayon", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" - -[[package]] -name = "linked-hash-map" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" - -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "maze" -version = "3.0.0" -dependencies = [ - "maze-test", - "rand", - "serde", - "serde_json", - "svg", -] - -[[package]] -name = "maze-maker" -version = "3.0.0" -dependencies = [ - "clap", - "image", - "maze", - "maze-tools", - "rand", - "rayon", - "svg", -] - -[[package]] -name = "maze-test" -version = "3.0.0" - -[[package]] -name = "maze-tools" -version = "3.0.0" -dependencies = [ - "lazy_static", - "maze", -] - -[[package]] -name = "maze-web" -version = "3.0.0" -dependencies = [ - "actix-web", - "futures-util", - "maze", - "rand", - "serde", - "serde_urlencoded", - "svg", -] - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memoffset" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "net2" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num-integer" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "once_cell" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if", - "cloudabi", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pin-project" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "png" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide 0.3.7", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" - -[[package]] -name = "proc-macro-hack" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" - -[[package]] -name = "proc-macro-nested" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" - -[[package]] -name = "proc-macro2" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rayon" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd016f0c045ad38b5251be2c9c0ab806917f82da4d36b2a327e5166adad9270" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91739a34c4355b5434ce54c9086c5895604a9c278586d1f1aa95e04f66b525a0" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "resolv-conf" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" -dependencies = [ - "hostname", - "quick-error", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" -dependencies = [ - "dtoa", - "itoa", - "serde", - "url", -] - -[[package]] -name = "sha-1" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" -dependencies = [ - "block-buffer", - "cfg-if", - "cpuid-bool", - "digest", - "opaque-debug", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - -[[package]] -name = "signal-hook-registry" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" -dependencies = [ - "arc-swap", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "smallvec" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" - -[[package]] -name = "socket2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.9", -] - -[[package]] -name = "standback" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a71ea1ea5f8747d1af1979bfb7e65c3a025a70609f04ceb78425bc5adad8e6" -dependencies = [ - "version_check", -] - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "svg" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b65a64d32a41db2a8081aa03c1ccca26f246ff681add693f8b01307b137da79" - -[[package]] -name = "syn" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "tiff" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b8a87c4da944c3f27e5943289171ac71a6150a79ff6bacfff06d159dfff2f" -dependencies = [ - "byteorder", - "lzw", - "miniz_oxide 0.3.7", -] - -[[package]] -name = "time" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4953c513c9bf1b97e9cdd83f11d60c4b0a83462880a360d80d96953a953fee" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - -[[package]] -name = "tinyvec" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" - -[[package]] -name = "tokio" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" -dependencies = [ - "bytes", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-uds", - "pin-project-lite", - "signal-hook-registry", - "slab", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tracing" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" -dependencies = [ - "cfg-if", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "trust-dns-proto" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd7061ba6f4d4d9721afedffbfd403f20f39a4301fee1b70d6fcd09cca69f28" -dependencies = [ - "async-trait", - "backtrace", - "enum-as-inner", - "futures", - "idna", - "lazy_static", - "log", - "rand", - "smallvec", - "thiserror", - "tokio", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77" -dependencies = [ - "backtrace", - "cfg-if", - "futures", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "trust-dns-proto", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "url" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasm-bindgen" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "widestring" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a763e303c0e0f23b0da40888724762e802a8ffefbc22de4127ef42493c2ea68c" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[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-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] From 4bca5a8aeedbf8c1cf4fa57b8d84a40a7f45ce91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Fri, 18 Dec 2020 22:35:03 +0100 Subject: [PATCH 07/12] Updated dependencies --- maker/Cargo.toml | 2 +- maze/Cargo.toml | 4 ++-- maze/src/initialize/mod.rs | 4 ++-- web/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maker/Cargo.toml b/maker/Cargo.toml index ae20b0d..c5ecca3 100644 --- a/maker/Cargo.toml +++ b/maker/Cargo.toml @@ -11,4 +11,4 @@ clap = "2.33" image = "0.23" rand = "*" rayon = "1.3" -svg = "*" +svg = "0.10" diff --git a/maze/Cargo.toml b/maze/Cargo.toml index ef8abeb..e249381 100644 --- a/maze/Cargo.toml +++ b/maze/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Moses Palmér "] edition = "2021" [dependencies] -rand = { version = "0.7", optional = true } +rand = { version = "0.8", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } -svg = { version = "0.8", optional = true } +svg = { version = "0.10", optional = true } maze-test = { path = "../test" } [dev-dependencies] diff --git a/maze/src/initialize/mod.rs b/maze/src/initialize/mod.rs index ed51dc1..9485c8b 100644 --- a/maze/src/initialize/mod.rs +++ b/maze/src/initialize/mod.rs @@ -130,9 +130,9 @@ where { fn range(&mut self, a: usize, b: usize) -> usize { if a < b { - self.gen_range(a, b) + self.gen_range(a..b) } else { - self.gen_range(b, a) + self.gen_range(b..a) } } diff --git a/web/Cargo.toml b/web/Cargo.toml index 6e44207..a6b93e5 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] maze = { path = "../maze" } -actix-web = "3.0" +actix-web = "3" futures-util = "*" rand = "*" serde = "*" From 365dd34ed934a92601b1ebd5a127a032a6aedfc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Fri, 18 Dec 2020 22:38:43 +0100 Subject: [PATCH 08/12] Extended and updated documentation --- maker/src/types/background_renderer.rs | 2 +- maker/src/types/mask_initializer.rs | 2 +- maze/src/lib.rs | 9 +++++++++ maze/src/matrix.rs | 5 ++++- maze/src/physical.rs | 6 ++++++ maze/src/room.rs | 3 ++- maze/src/shape/mod.rs | 26 ++++++++++++++++++++++++++ tools/src/image/mod.rs | 2 +- 8 files changed, 50 insertions(+), 5 deletions(-) diff --git a/maker/src/types/background_renderer.rs b/maker/src/types/background_renderer.rs index eb61a2b..d74db62 100644 --- a/maker/src/types/background_renderer.rs +++ b/maker/src/types/background_renderer.rs @@ -25,7 +25,7 @@ impl FromStr for BackgroundRenderer { Ok(Self { image: image::open(s) .map_err(|_| format!("failed to open {}", s))? - .to_rgb(), + .to_rgb8(), }) } } diff --git a/maker/src/types/mask_initializer.rs b/maker/src/types/mask_initializer.rs index 4d2361e..80b073f 100644 --- a/maker/src/types/mask_initializer.rs +++ b/maker/src/types/mask_initializer.rs @@ -46,7 +46,7 @@ where Ok(Self { image: image::open(path) .map_err(|_| format!("failed to open {}", s))? - .to_rgb(), + .to_rgb8(), threshold, _marker: ::std::marker::PhantomData, }) diff --git a/maze/src/lib.rs b/maze/src/lib.rs index d50d6c4..3408784 100644 --- a/maze/src/lib.rs +++ b/maze/src/lib.rs @@ -61,10 +61,13 @@ where { /// Creates an uninitialised maze. /// + /// This method allows creating a maze initialised with data. + /// /// # Arguments /// * `shape` - The shape of the rooms. /// * `width` - The width, in rooms, of the maze. /// * `height` - The height, in rooms, of the maze. + /// * `data` - A function providing room data. pub fn new_with_data( shape: Shape, width: usize, @@ -113,6 +116,8 @@ where /// The data for a specific room. /// + /// If the index is out of bounds, nothing is returned. + /// /// # Arguments /// * `pos``- The room position. pub fn data(&self, pos: matrix::Pos) -> Option<&T> { @@ -121,6 +126,8 @@ where /// The mutable data for a specific room. /// + /// If the position is out of bounds, nothing is returned. + /// /// # Arguments /// * `pos``- The room position. pub fn data_mut(&mut self, pos: matrix::Pos) -> Option<&mut T> { @@ -137,6 +144,8 @@ where /// Whether a wall is open. /// + /// If the position is out of bounds, `false` is returned. + /// /// # Arguments /// * `wall_pos` - The wall position. pub fn is_open(&self, wall_pos: WallPos) -> bool { diff --git a/maze/src/matrix.rs b/maze/src/matrix.rs index 4a84659..ac92a42 100644 --- a/maze/src/matrix.rs +++ b/maze/src/matrix.rs @@ -533,9 +533,11 @@ where /// matrix1[Pos { col: 1, row: 0 }] = 1; /// matrix1[Pos { col: 0, row: 1 }] = 2; /// matrix1[Pos { col: 1, row: 1 }] = 3; + /// /// let mut matrix2 = Matrix::new(2, 2); /// matrix2[Pos { col: 0, row: 0 }] = 5; /// matrix2[Pos { col: 1, row: 1 }] = 5; + /// /// assert_eq!( /// (matrix1 + matrix2).map(|v| v + 1) /// .values() @@ -736,7 +738,8 @@ pub fn partition(x: f32) -> (isize, f32) { /// Generates a matrix initialised with the value returned by a filter /// function. /// -/// The return value contains the number of filtered rooms. +/// The return value contains the number of `true` values returned by the +/// filter. /// /// # Arguments /// * `width` - The width of the matrix to generate. diff --git a/maze/src/physical.rs b/maze/src/physical.rs index ffeec8a..b8a9840 100644 --- a/maze/src/physical.rs +++ b/maze/src/physical.rs @@ -23,6 +23,9 @@ pub struct Pos { impl Pos { /// A scalar value signifying distance from _(0, 0)_. /// + /// The length of the position vector is given by the square root of this + /// value. + /// /// # Example /// /// ``` @@ -131,6 +134,9 @@ impl ops::Add for Pos { /// Adds the delta values of an angle to this position. /// + /// This is equal to to adding the position vector generated by the cosine + /// and sine values of the angle. + /// /// # Example /// /// ``` diff --git a/maze/src/room.rs b/maze/src/room.rs index 7cae3a7..02156f5 100644 --- a/maze/src/room.rs +++ b/maze/src/room.rs @@ -14,9 +14,10 @@ pub struct Room where T: Clone, { + /// A bit mask of open walls. walls: wall::Mask, - /// Whether this room has been visited. This is true if at least one door + /// Whether this room has been visited. This is true if at least one wall /// has at any time been opened. pub visited: bool, diff --git a/maze/src/shape/mod.rs b/maze/src/shape/mod.rs index 559e9cb..4691130 100644 --- a/maze/src/shape/mod.rs +++ b/maze/src/shape/mod.rs @@ -20,6 +20,8 @@ const COS_45: f32 = 0.707_106_77f32; const SIN_45: f32 = 0.707_106_77f32; /// Dispatches a function call for the current maze to a shape defined module. +/// +/// This is an internal library macro. macro_rules! dispatch { ($on:expr => $func:ident ( $($args:ident $(,)?)* ) ) => { match $on { @@ -283,6 +285,26 @@ impl std::str::FromStr for Shape { /// /// The string must be one of the supported names, lower-cased. /// + /// # Examples + /// + /// ``` + /// # use std::str::FromStr; + /// # use maze::Shape; + /// + /// assert_eq!( + /// "hex".parse(), + /// Ok(Shape::Hex), + /// ); + /// assert_eq!( + /// "quad".parse(), + /// Ok(Shape::Quad), + /// ); + /// assert_eq!( + /// "tri".parse(), + /// Ok(Shape::Tri), + /// ); + /// ``` + /// /// # Arguments /// * `source` - The source string. fn from_str(source: &str) -> Result { @@ -300,6 +322,10 @@ where T: Clone, { /// All walls for a shape. + /// + /// This method does not necessarily return an array where the length is + /// equal to the number of walls, since walls for all room layouts are + /// present. pub fn all_walls(&self) -> &'static [&'static wall::Wall] { self.shape.all_walls() } diff --git a/tools/src/image/mod.rs b/tools/src/image/mod.rs index d2baa67..1e5c6bb 100644 --- a/tools/src/image/mod.rs +++ b/tools/src/image/mod.rs @@ -59,7 +59,7 @@ impl str::FromStr for Color { /// Converts a string to a colour. /// - /// This method supports colouts on the form `#RRGGBB` and `#RRGGBBAA`, + /// This method supports colours on the form `#RRGGBB` and `#RRGGBBAA`, /// where `RR`, `GG`, `BB` and `AA` are the red, green, blue and alpha /// components hex encoded. /// From 5d0f502b3bd7c655d95be135c207d63a7a47a879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Fri, 18 Dec 2020 22:40:14 +0100 Subject: [PATCH 09/12] Use rustdoc links --- maker/src/types/break_post_processor.rs | 3 +-- maker/src/types/heatmap_renderer.rs | 4 ++-- maze/src/initialize/mod.rs | 4 +--- maze/src/matrix.rs | 13 ++++++------- maze/src/wall.rs | 2 +- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/maker/src/types/break_post_processor.rs b/maker/src/types/break_post_processor.rs index d575d2c..b14143d 100644 --- a/maker/src/types/break_post_processor.rs +++ b/maker/src/types/break_post_processor.rs @@ -20,8 +20,7 @@ impl FromStr for BreakPostProcessor { /// /// The string can be on two forms: /// 1. `map_type`: If only a value that can be made into a - /// [HeatMapType](struct.HeatMapType.html) is passed, the `count` will be - /// `1`. + /// [`HeatMapType`](HeatMapType) is passed, the `count` will be `1`. /// 2. `map_type,count`: If a count is passed, it will be used as `count`. fn from_str(s: &str) -> Result { let mut parts = s.split(',').map(str::trim); diff --git a/maker/src/types/heatmap_renderer.rs b/maker/src/types/heatmap_renderer.rs index a9572c8..7cd38c1 100644 --- a/maker/src/types/heatmap_renderer.rs +++ b/maker/src/types/heatmap_renderer.rs @@ -25,8 +25,8 @@ impl FromStr for HeatMapRenderer { /// /// The string can be on three forms: /// 1. `map_type`: If only a value that can be made into a - /// [HeatMapType](struct.HeatMapType.html) is passed, the `from` and `to` - /// values will be `#000000FF` and `#FFFF0000`. + /// [`HeatMapType`](HeatMapType) is passed, the `from` and `to` values + /// will be `#000000FF` and `#FFFF0000`. /// 2. `map_type,colour`: If only one colour is passed, the `from` and `to` /// values will be `#00000000` and the colour passed. /// 3. `map_type,from,to`: If two colours are passed, they are used as diff --git a/maze/src/initialize/mod.rs b/maze/src/initialize/mod.rs index 9485c8b..eec6670 100644 --- a/maze/src/initialize/mod.rs +++ b/maze/src/initialize/mod.rs @@ -61,9 +61,7 @@ pub enum Method { impl Eq for Method {} impl Default for Method { - /// The default initialisation method is [`Branching`]. - /// - /// [`Branching`]: #variant.Branching + /// The default initialisation method is [`Branching`](Method::Branchin). fn default() -> Self { Method::Branching } diff --git a/maze/src/matrix.rs b/maze/src/matrix.rs index ac92a42..f4fa48a 100644 --- a/maze/src/matrix.rs +++ b/maze/src/matrix.rs @@ -57,9 +57,8 @@ where /// A matrix is a two dimensional array. /// -/// Every cell has a value, which is addressed using a [`Pos`]. -/// -/// [`Pos`]: struct.Pos.html +/// Every cell has a value, which is addressed using a +/// [`Pos`](crate::matrix::Pos). #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct Matrix @@ -672,8 +671,8 @@ where /// * `pos` - The matrix position. /// /// # Panics - /// Accessing a cell where [is_inside](#method.is_inside) returns `false` - /// will cause a panic. Use [get](#method.get) to avoid this. + /// Accessing a cell where [`is_inside`](Self::is_inside) returns `false` + /// will cause a panic. Use [`get`](Self::get) to avoid this. fn index(&self, pos: Pos) -> &Self::Output { if self.is_inside(pos) { &self.data[(pos.col + pos.row * self.width as isize) as usize] @@ -693,8 +692,8 @@ where /// * `pos` - The matrix position. /// /// # Panics - /// Accessing a cell where [is_inside](#method.is_inside) returns `false` - /// will cause a panic. Use [get_mut](#method.get_mut) to avoid this. + /// Accessing a cell where [`is_inside`](Self::is_inside) returns `false` + /// will cause a panic. Use [`get_mut`](Self::get_mut) to avoid this. fn index_mut(&mut self, pos: Pos) -> &mut T { if self.is_inside(pos) { &mut self.data[(pos.col + pos.row * self.width as isize) as usize] diff --git a/maze/src/wall.rs b/maze/src/wall.rs index 8be3603..f9d4353 100644 --- a/maze/src/wall.rs +++ b/maze/src/wall.rs @@ -42,7 +42,7 @@ pub struct Angle { /// A wall. /// -/// Walls have an index, which is used by [Room](../room/struct.Room.html) to +/// Walls have an index, which is used by [`Room`](crate::room::Room) to /// generate bit masks, and a direction, which indicates the position of the /// room on the other side of a wall, relative to the room to which the wall /// belongs. From d272a32e4ff43885a8ec795aa8fa1efd3e71425b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Fri, 18 Dec 2020 22:41:08 +0100 Subject: [PATCH 10/12] Reduced visibility --- maze/src/lib.rs | 2 +- maze/src/walk.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maze/src/lib.rs b/maze/src/lib.rs index 3408784..eeca14a 100644 --- a/maze/src/lib.rs +++ b/maze/src/lib.rs @@ -23,7 +23,7 @@ pub mod walk; pub type WallPos = (matrix::Pos, &'static wall::Wall); /// A matrix of rooms. -pub type Rooms = matrix::Matrix>; +type Rooms = matrix::Matrix>; /// A maze contains rooms and has methods for managing paths and doors. #[derive(Clone)] diff --git a/maze/src/walk.rs b/maze/src/walk.rs index 63f252a..3ba54ef 100644 --- a/maze/src/walk.rs +++ b/maze/src/walk.rs @@ -161,7 +161,7 @@ where /// /// It is possible to walk indefinitely if the mapping contains circular /// references. - pub fn new( + pub(self) fn new( maze: &'a Maze, start: matrix::Pos, map: BTreeMap, From da8bb637a4ed4ad330d1fa2ee2c80a8a3508458b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Tue, 2 Feb 2021 18:30:00 +0100 Subject: [PATCH 11/12] Moved macros to separate module --- maze/src/lib.rs | 4 ++- maze/src/macros.rs | 60 ++++++++++++++++++++++++++++++++++++++++++ maze/src/shape/mod.rs | 61 ------------------------------------------- 3 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 maze/src/macros.rs diff --git a/maze/src/lib.rs b/maze/src/lib.rs index eeca14a..44ddb49 100644 --- a/maze/src/lib.rs +++ b/maze/src/lib.rs @@ -6,9 +6,11 @@ use serde::{Deserialize, Serialize}; #[cfg(test)] mod test_utils; +#[macro_use] +mod macros; + pub mod wall; -#[macro_use] pub mod shape; pub use self::shape::Shape; diff --git a/maze/src/macros.rs b/maze/src/macros.rs new file mode 100644 index 0000000..d98a59c --- /dev/null +++ b/maze/src/macros.rs @@ -0,0 +1,60 @@ +/// Dispatches a function call for the current maze to a shape defined module. +/// +/// This is an internal library macro. +macro_rules! dispatch { + ($on:expr => $func:ident ( $($args:ident $(,)?)* ) ) => { + match $on { + crate::Shape::Hex => hex::$func($($args,)*), + crate::Shape::Quad => quad::$func($($args,)*), + crate::Shape::Tri => tri::$func($($args,)*), + } + } +} + +/// Defines a wall module. +/// +/// This is an internal library macro. +macro_rules! define_shape { + ( << $name:ident >> $( $wall_name:ident ( $ordinal:expr ) = { + $( $field:ident: $val:expr, )* + } ),* ) => { + #[allow(unused_imports, non_camel_case_types)] + pub mod walls { + use $crate::wall as wall; + use super::*; + + pub enum WallIndex { + $($wall_name,)* + } + + $(pub static $wall_name: wall::Wall = wall::Wall { + name: concat!(stringify!($name), ":", stringify!($wall_name)), + shape: crate::shape::Shape::$name, + index: WallIndex::$wall_name as usize, + ordinal: $ordinal, + $( $field: $val, )* + } );*; + + pub static ALL: &[&'static wall::Wall] = &[$(&$wall_name),*]; + } + + /// Returns all walls used in this type of maze. + pub fn all_walls() -> &'static [&'static wall::Wall] { + &walls::ALL + } + + /// Returns the wall on the back of `wall_pos`. + /// + /// # Arguments + /// * `wall_pos` - The wall for which to find the back. + pub fn back(wall_pos: WallPos) -> WallPos { + let (pos, wall) = wall_pos; + let other = matrix::Pos { + col: pos.col + wall.dir.0, + row: pos.row + wall.dir.1, + }; + + (other, walls::ALL[self::back_index(wall.index)]) + } + } +} diff --git a/maze/src/shape/mod.rs b/maze/src/shape/mod.rs index 4691130..f61de92 100644 --- a/maze/src/shape/mod.rs +++ b/maze/src/shape/mod.rs @@ -19,67 +19,6 @@ const COS_45: f32 = 0.707_106_77f32; /// sin(45°) const SIN_45: f32 = 0.707_106_77f32; -/// Dispatches a function call for the current maze to a shape defined module. -/// -/// This is an internal library macro. -macro_rules! dispatch { - ($on:expr => $func:ident ( $($args:ident $(,)?)* ) ) => { - match $on { - crate::Shape::Hex => hex::$func($($args,)*), - crate::Shape::Quad => quad::$func($($args,)*), - crate::Shape::Tri => tri::$func($($args,)*), - } - } -} - -/// Defines a wall module. -/// -/// This is an internal library macro. -macro_rules! define_shape { - ( << $name:ident >> $( $wall_name:ident ( $ordinal:expr ) = { - $( $field:ident: $val:expr, )* - } ),* ) => { - #[allow(unused_imports, non_camel_case_types)] - pub mod walls { - use $crate::wall as wall; - use super::*; - - pub enum WallIndex { - $($wall_name,)* - } - - $(pub static $wall_name: wall::Wall = wall::Wall { - name: concat!(stringify!($name), ":", stringify!($wall_name)), - shape: crate::shape::Shape::$name, - index: WallIndex::$wall_name as usize, - ordinal: $ordinal, - $( $field: $val, )* - } );*; - - pub static ALL: &[&'static wall::Wall] = &[$(&$wall_name),*]; - } - - /// Returns all walls used in this type of maze. - pub fn all_walls() -> &'static [&'static wall::Wall] { - &walls::ALL - } - - /// Returns the wall on the back of `wall_pos`. - /// - /// # Arguments - /// * `wall_pos` - The wall for which to find the back. - pub fn back(wall_pos: WallPos) -> WallPos { - let (pos, wall) = wall_pos; - let other = matrix::Pos { - col: pos.col + wall.dir.0, - row: pos.row + wall.dir.1, - }; - - (other, walls::ALL[self::back_index(wall.index)]) - } - } -} - /// The different types of mazes implemented, identified by number of walls. #[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd)] #[cfg_attr( From 20057605073414399598253f27d107c673c250da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moses=20Palm=C3=A9r?= Date: Fri, 18 Dec 2020 22:40:36 +0100 Subject: [PATCH 12/12] Simplified code --- maze/src/initialize/braid.rs | 21 +++++++------------ .../{randomized_prim.rs => branching.rs} | 15 +++---------- maze/src/initialize/clear.rs | 15 +++---------- maze/src/initialize/mod.rs | 21 ++++++++++--------- .../initialize/{depth_first.rs => winding.rs} | 13 +++--------- maze/src/lib.rs | 9 +++----- maze/src/wall.rs | 17 +++++++-------- tools/src/alphabet/macros.rs | 18 ++++++++++++++-- tools/src/alphabet/mod.rs | 14 ++++++------- tools/src/image/mod.rs | 7 +------ 10 files changed, 60 insertions(+), 90 deletions(-) rename maze/src/initialize/{randomized_prim.rs => branching.rs} (85%) rename maze/src/initialize/{depth_first.rs => winding.rs} (86%) diff --git a/maze/src/initialize/braid.rs b/maze/src/initialize/braid.rs index 75060bd..c32367a 100644 --- a/maze/src/initialize/braid.rs +++ b/maze/src/initialize/braid.rs @@ -9,28 +9,19 @@ use crate::matrix; /// This method will leave no dead ends in the final maze; all rooms will have /// at least two open walls. /// -/// This method will ignore rooms for which `filter` returns `false`. -/// /// # Arguments /// * `maze``- The maze to initialise. -/// * `rng` - Not used. -/// * `filter` - A predicate filtering rooms to consider. -pub(crate) fn initialize( +/// * `rng` - A random number generator. +/// * `candidates` - A filter for the rooms to modify. +pub(crate) fn initialize( mut maze: Maze, rng: &mut R, - filter: F, + candidates: matrix::Matrix, ) -> Maze where - F: Fn(matrix::Pos) -> bool, R: super::Randomizer + Sized, T: Clone, { - let (count, candidates) = - matrix::filter(maze.width(), maze.height(), |pos| filter(pos)); - if count == 0 { - return maze; - } - // First remove all inner walls for pos in maze.positions().filter(|&pos| candidates[pos]) { for wall in maze.walls(pos) { @@ -76,7 +67,9 @@ where } } - super::connect_all(&mut maze, rng, filter); + super::connect_all(&mut maze, rng, |pos| { + *candidates.get(pos).unwrap_or(&false) + }); maze } diff --git a/maze/src/initialize/randomized_prim.rs b/maze/src/initialize/branching.rs similarity index 85% rename from maze/src/initialize/randomized_prim.rs rename to maze/src/initialize/branching.rs index 7f61d4b..9c53e36 100644 --- a/maze/src/initialize/randomized_prim.rs +++ b/maze/src/initialize/branching.rs @@ -4,28 +4,19 @@ use crate::matrix; /// Initialises a maze using the _Randomised Prim_ algorithm. /// -/// This method will ignore rooms for which `filter` returns `false`. -/// /// # Arguments /// * `maze` - The maze to initialise. /// * `rng` - A random number generator. -/// * `filter` - A predicate filtering rooms to consider. -pub(crate) fn initialize( +/// * `candidates` - A filter for the rooms to modify. +pub(crate) fn initialize( mut maze: Maze, rng: &mut R, - filter: F, + mut candidates: matrix::Matrix, ) -> Maze where - F: Fn(matrix::Pos) -> bool, R: super::Randomizer + Sized, T: Clone, { - let (count, mut candidates) = - matrix::filter(maze.width(), maze.height(), filter); - if count == 0 { - return maze; - } - loop { // Start with all walls in a random room, except for those leading // out of the maze diff --git a/maze/src/initialize/clear.rs b/maze/src/initialize/clear.rs index 70bfce4..50905ae 100644 --- a/maze/src/initialize/clear.rs +++ b/maze/src/initialize/clear.rs @@ -4,28 +4,19 @@ use crate::matrix; /// Initialises a maze by clearing all inner walls. /// -/// This method will ignore rooms for which `filter` returns `false`. -/// /// # Arguments /// * `maze``- The maze to initialise. /// * `_rng` - Not used. -/// * `filter` - A predicate filtering rooms to consider. -pub(crate) fn initialize( +/// * `candidates` - A filter for the rooms to modify. +pub(crate) fn initialize( mut maze: Maze, _rng: &mut R, - filter: F, + candidates: matrix::Matrix, ) -> Maze where - F: Fn(matrix::Pos) -> bool, R: super::Randomizer + Sized, T: Clone, { - let (count, candidates) = - matrix::filter(maze.width(), maze.height(), filter); - if count == 0 { - return maze; - } - for pos in maze.positions().filter(|&pos| candidates[pos]) { for wall in maze.walls(pos) { let (pos, wall) = maze.back((pos, wall)); diff --git a/maze/src/initialize/mod.rs b/maze/src/initialize/mod.rs index eec6670..57b0575 100644 --- a/maze/src/initialize/mod.rs +++ b/maze/src/initialize/mod.rs @@ -15,12 +15,12 @@ use crate::Maze; use crate::matrix; mod braid; +mod branching; mod clear; -mod depth_first; -mod randomized_prim; +mod winding; /// The various supported initialisation method. -#[derive(Copy, Clone, Debug, Hash, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub enum Method { /// Initialises a maze with no dead ends. @@ -58,8 +58,6 @@ pub enum Method { Winding, } -impl Eq for Method {} - impl Default for Method { /// The default initialisation method is [`Branching`](Method::Branchin). fn default() -> Self { @@ -249,11 +247,14 @@ where F: Fn(matrix::Pos) -> bool, R: Randomizer + Sized, { - match method { - Method::Braid => braid::initialize(self, rng, filter), - Method::Clear => clear::initialize(self, rng, filter), - Method::Branching => randomized_prim::initialize(self, rng, filter), - Method::Winding => depth_first::initialize(self, rng, filter), + match matrix::filter(self.width(), self.height(), filter) { + (count, filter) if count > 0 => match method { + Method::Braid => braid::initialize(self, rng, filter), + Method::Clear => clear::initialize(self, rng, filter), + Method::Branching => branching::initialize(self, rng, filter), + Method::Winding => winding::initialize(self, rng, filter), + }, + _ => self, } } } diff --git a/maze/src/initialize/depth_first.rs b/maze/src/initialize/winding.rs similarity index 86% rename from maze/src/initialize/depth_first.rs rename to maze/src/initialize/winding.rs index 5421671..15c31d0 100644 --- a/maze/src/initialize/depth_first.rs +++ b/maze/src/initialize/winding.rs @@ -15,23 +15,16 @@ use crate::matrix; /// # Arguments /// * `maze``- The maze to initialise. /// * `rng` - A random number generator. -/// * `filter` - A predicate filtering rooms to consider. -pub(crate) fn initialize( +/// * `candidates` - A filter for the rooms to modify. +pub(crate) fn initialize( mut maze: Maze, rng: &mut R, - filter: F, + mut candidates: matrix::Matrix, ) -> Maze where - F: Fn(matrix::Pos) -> bool, R: super::Randomizer + Sized, T: Clone, { - let (count, mut candidates) = - matrix::filter(maze.width(), maze.height(), filter); - if count == 0 { - return maze; - } - // The backracking path is initially empty let mut path = Vec::new(); diff --git a/maze/src/lib.rs b/maze/src/lib.rs index 44ddb49..3e6e120 100644 --- a/maze/src/lib.rs +++ b/maze/src/lib.rs @@ -189,13 +189,10 @@ where pub fn connected(&self, pos1: matrix::Pos, pos2: matrix::Pos) -> bool { if pos1 == pos2 { true - } else if let Some(wall) = self.walls(pos1).iter().find(|wall| { - (pos1.col + wall.dir.0 == pos2.col) - && (pos1.row + wall.dir.1 == pos2.row) - }) { - self.is_open((pos1, wall)) } else { - false + self.connecting_wall(pos1, pos2) + .map(|wall_pos| self.is_open(wall_pos)) + .unwrap_or(false) } } diff --git a/maze/src/wall.rs b/maze/src/wall.rs index f9d4353..fafd908 100644 --- a/maze/src/wall.rs +++ b/maze/src/wall.rs @@ -1,11 +1,10 @@ +use std::f32::consts::TAU; + #[cfg(feature = "serde")] use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; use crate::shape::Shape; -/// The maximum nomalised value of a radian. -const RADIAN_BOUND: f32 = 2.0 * std::f32::consts::PI; - /// A wall index. pub type Index = usize; @@ -95,14 +94,14 @@ impl Wall { /// # Arguments /// * `angle` - The angle to normalise. pub fn normalized_angle(angle: f32) -> f32 { - if angle < RADIAN_BOUND && angle >= 0.0 { + if angle < TAU && angle >= 0.0 { angle } else { - let t = angle % RADIAN_BOUND; + let t = angle % TAU; if t >= 0.0 { t } else { - t + RADIAN_BOUND + t + TAU } } } @@ -193,6 +192,7 @@ impl Serialize for Wall { #[cfg(test)] mod tests { use std::collections::HashSet; + use std::f32::consts::PI; use maze_test::maze_test; @@ -331,10 +331,7 @@ mod tests { for col in 0..=1 { failures.extend( (0..=count) - .map(|t| { - 2.0 * (RADIAN_BOUND * (t as f32 / count as f32) - - std::f32::consts::PI) - }) + .map(|t| 2.0 * (TAU * (t as f32 / count as f32) - PI)) .filter(|&a| { maze.walls(matrix::Pos { col, row: 0 }) .iter() diff --git a/tools/src/alphabet/macros.rs b/tools/src/alphabet/macros.rs index d077e51..566f6b1 100644 --- a/tools/src/alphabet/macros.rs +++ b/tools/src/alphabet/macros.rs @@ -14,10 +14,24 @@ /// ) /// ``` macro_rules! character { - () => {}; + (O) => { + false + }; + (X) => { + true + }; ($($a:ident $b:ident $c:ident $d:ident $e:ident $f:ident $g:ident $h:ident)*) => { [ - $([$a, $b, $c, $d, $e, $f, $g, $h],)* + $([ + character!($a), + character!($b), + character!($c), + character!($d), + character!($e), + character!($f), + character!($g), + character!($h), + ],)* ] }; } diff --git a/tools/src/alphabet/mod.rs b/tools/src/alphabet/mod.rs index 286d412..1d3cdb0 100644 --- a/tools/src/alphabet/mod.rs +++ b/tools/src/alphabet/mod.rs @@ -12,14 +12,8 @@ const WIDTH: usize = 8; /// The height of a character bitmap. const HEIGHT: usize = 8; -/// The value `1.0f32` in a convenient representation for the alphabet macro. -const X: f32 = 1.0; - -/// The value `0.0f32` in a convenient representation for the alphabet macro. -const O: f32 = 0.0; - /// A character bitmap. -pub struct Character(pub(self) [[f32; WIDTH]; HEIGHT]); +pub struct Character(pub(self) [[bool; WIDTH]; HEIGHT]); impl Character { /// Retrieves an interpolated bit from the bitmap. @@ -71,7 +65,11 @@ impl Character { && pos.col < WIDTH as isize && pos.row < HEIGHT as isize { - self.0[pos.row as usize][pos.col as usize] + if self.0[pos.row as usize][pos.col as usize] { + 1.0 + } else { + 0.0 + } } else { 0.0 } diff --git a/tools/src/image/mod.rs b/tools/src/image/mod.rs index 1e5c6bb..57bedff 100644 --- a/tools/src/image/mod.rs +++ b/tools/src/image/mod.rs @@ -19,12 +19,7 @@ pub struct Color { impl Color { /// Returns a fully transparent version of this colour. pub fn transparent(self) -> Self { - Self { - red: self.red, - green: self.blue, - blue: self.blue, - alpha: 0, - } + Self { alpha: 0, ..self } } /// Fades one colour to another.