From 1b740b1f2f8c11c26d7b5d5570684060a97ed77f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 18:49:27 -0400 Subject: [PATCH 01/17] Update dependencies. --- Cargo.lock | 397 +++++++++++++++++++++++++---------------------------- 1 file changed, 187 insertions(+), 210 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6384d74..34c66d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,68 +1,69 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -73,23 +74,23 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -118,18 +119,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes" -version = "1.5.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cfg-if" @@ -139,9 +131,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.6" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -149,9 +141,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -160,9 +152,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -172,15 +164,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "duster" @@ -216,9 +208,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -231,9 +223,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -241,15 +233,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -258,15 +250,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -275,21 +267,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -305,9 +297,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gloo-utils" @@ -324,21 +316,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "idna" @@ -352,18 +338,18 @@ dependencies = [ [[package]] name = "include_dir" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" dependencies = [ "include_dir_macros", ] [[package]] name = "include_dir_macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" dependencies = [ "proc-macro2", "quote", @@ -371,25 +357,31 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", ] [[package]] -name = "itoa" -version = "1.0.9" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -409,21 +401,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.149" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -433,11 +425,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -480,30 +472,20 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" -version = "0.32.1" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "organic" @@ -524,9 +506,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -536,18 +518,18 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -560,15 +542,15 @@ checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -581,18 +563,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -601,20 +583,21 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "610f75ff4a8e3cb29b85da56eabdd1bff5b06739059a4b8e2967fef32e5d9944" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -636,9 +619,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "2.0.38" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -653,9 +636,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -668,21 +651,20 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", - "num_cpus", "pin-project-lite", ] [[package]] name = "toml" -version = "0.8.2" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -692,18 +674,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -714,30 +696,30 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -746,21 +728,21 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -768,19 +750,20 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -793,9 +776,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -803,9 +786,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -816,69 +799,57 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", ] -[[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.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] -[[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.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -887,51 +858,57 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.17" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] From 0da375c52923ba617f75640cc95718e3ce2735fd Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:05:29 -0400 Subject: [PATCH 02/17] Add a function to recursively list all entries in a directory with tokio. --- src/command/build/mod.rs | 1 + src/command/build/walk_fs.rs | 26 ++++++++++++++++++++++++++ src/main.rs | 1 + 3 files changed, 28 insertions(+) create mode 100644 src/command/build/walk_fs.rs diff --git a/src/command/build/mod.rs b/src/command/build/mod.rs index b1b161e..6b8fd66 100644 --- a/src/command/build/mod.rs +++ b/src/command/build/mod.rs @@ -1,5 +1,6 @@ mod render; mod runner; mod stylesheet; +mod walk_fs; pub(crate) use runner::build_site; diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs new file mode 100644 index 0000000..7b427ee --- /dev/null +++ b/src/command/build/walk_fs.rs @@ -0,0 +1,26 @@ +use std::ops::AsyncFn; +use std::path::Path; + +use tokio::fs::DirEntry; + +use crate::error::CustomError; + +pub(crate) async fn walk_fs, F: AsyncFn(&DirEntry) -> Result>( + root: P, + predicate: F, +) -> Result, CustomError> { + let mut ret = Vec::new(); + let mut entries = tokio::fs::read_dir(root).await?; + while let Some(entry) = entries.next_entry().await? { + let file_type = entry.file_type().await?; + if file_type.is_dir() { + let child_entries = walk_fs(entry.path(), &predicate).await?; + ret.extend(child_entries); + } + if predicate(&entry).await? { + ret.push(entry); + } + } + + Ok(ret) +} diff --git a/src/main.rs b/src/main.rs index 7feed97..09fb643 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ #![feature(let_chains)] +#![feature(async_closure)] use std::process::ExitCode; use clap::Parser; From be467c807402c7660f6c03168232dd3a275cdb99 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:13:50 -0400 Subject: [PATCH 03/17] infinite recursion? --- src/command/build/runner.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 42deb7b..b8361dc 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -4,6 +4,7 @@ use std::sync::Arc; use std::sync::Mutex; use super::stylesheet::Stylesheet; +use super::walk_fs::walk_fs; use crate::cli::parameters::BuildArgs; use crate::command::build::render::SiteRenderer; use crate::config::Config; @@ -60,6 +61,8 @@ async fn get_output_directory(config: &Config) -> Result { } async fn get_post_directories(config: &Config) -> Result, CustomError> { + walk_fs(config.get_posts_directory(), async |entry| Ok(true)).await?; + let mut ret = Vec::new(); if !config.get_posts_directory().exists() { return Ok(ret); From 5d3a6c4174ca76411fb0124a31f22a7df9e94756 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:15:23 -0400 Subject: [PATCH 04/17] Also infinite. --- src/command/build/runner.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index b8361dc..a36c9af 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -17,6 +17,7 @@ use crate::intermediate::PageInput; use crate::intermediate::Registry; use include_dir::include_dir; use include_dir::Dir; +use tokio::fs::DirEntry; static DEFAULT_STYLESHEETS: Dir = include_dir!("$CARGO_MANIFEST_DIR/default_environment/stylesheet"); @@ -60,8 +61,12 @@ async fn get_output_directory(config: &Config) -> Result { Ok(output_directory) } +async fn filter_to_post_directories(entry: &DirEntry) -> Result { + Ok(true) +} + async fn get_post_directories(config: &Config) -> Result, CustomError> { - walk_fs(config.get_posts_directory(), async |entry| Ok(true)).await?; + walk_fs(config.get_posts_directory(), filter_to_post_directories).await?; let mut ret = Vec::new(); if !config.get_posts_directory().exists() { From 98fa43575d1ba0045584ebbc3ea693bb6253954f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:19:40 -0400 Subject: [PATCH 05/17] Require boxing?. --- src/command/build/runner.rs | 2 +- src/command/build/walk_fs.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index a36c9af..4bf1ade 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -61,7 +61,7 @@ async fn get_output_directory(config: &Config) -> Result { Ok(output_directory) } -async fn filter_to_post_directories(entry: &DirEntry) -> Result { +fn filter_to_post_directories(entry: &DirEntry) -> Result { Ok(true) } diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index 7b427ee..9795ca1 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -5,19 +5,19 @@ use tokio::fs::DirEntry; use crate::error::CustomError; -pub(crate) async fn walk_fs, F: AsyncFn(&DirEntry) -> Result>( +pub(crate) async fn walk_fs>( root: P, - predicate: F, + predicate: fn(&DirEntry) -> Result, ) -> Result, CustomError> { let mut ret = Vec::new(); let mut entries = tokio::fs::read_dir(root).await?; while let Some(entry) = entries.next_entry().await? { let file_type = entry.file_type().await?; if file_type.is_dir() { - let child_entries = walk_fs(entry.path(), &predicate).await?; + let child_entries = walk_fs(entry.path(), predicate).await?; ret.extend(child_entries); } - if predicate(&entry).await? { + if predicate(&entry)? { ret.push(entry); } } From ae3add9c81ff8c8da66678524f822cd0eaee0b49 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:22:39 -0400 Subject: [PATCH 06/17] Fixed recursion using a BoxFuture. --- src/command/build/walk_fs.rs | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index 9795ca1..143e811 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -1,26 +1,31 @@ use std::ops::AsyncFn; use std::path::Path; +use futures::future::BoxFuture; +use futures::FutureExt; use tokio::fs::DirEntry; use crate::error::CustomError; -pub(crate) async fn walk_fs>( +pub(crate) fn walk_fs + std::marker::Send + 'static>( root: P, predicate: fn(&DirEntry) -> Result, -) -> Result, CustomError> { - let mut ret = Vec::new(); - let mut entries = tokio::fs::read_dir(root).await?; - while let Some(entry) = entries.next_entry().await? { - let file_type = entry.file_type().await?; - if file_type.is_dir() { - let child_entries = walk_fs(entry.path(), predicate).await?; - ret.extend(child_entries); +) -> BoxFuture<'static, Result, CustomError>> { + async move { + let mut ret = Vec::new(); + let mut entries = tokio::fs::read_dir(root).await?; + while let Some(entry) = entries.next_entry().await? { + let file_type = entry.file_type().await?; + if file_type.is_dir() { + let child_entries = walk_fs(entry.path(), predicate).await?; + ret.extend(child_entries); + } + if predicate(&entry)? { + ret.push(entry); + } } - if predicate(&entry)? { - ret.push(entry); - } - } - Ok(ret) + Ok(ret) + } + .boxed() } From 8868cfb63fe3fa7912ed251e497bb1e7cd6dbbb2 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:23:22 -0400 Subject: [PATCH 07/17] Don't need to hard-code static lifetime. --- src/command/build/walk_fs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index 143e811..a214941 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -7,10 +7,10 @@ use tokio::fs::DirEntry; use crate::error::CustomError; -pub(crate) fn walk_fs + std::marker::Send + 'static>( +pub(crate) fn walk_fs<'p, P: AsRef + std::marker::Send + 'p>( root: P, predicate: fn(&DirEntry) -> Result, -) -> BoxFuture<'static, Result, CustomError>> { +) -> BoxFuture<'p, Result, CustomError>> { async move { let mut ret = Vec::new(); let mut entries = tokio::fs::read_dir(root).await?; From b6cc7a70b7365ddaffee412eae5842a9b61cec82 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 18 Oct 2024 21:29:15 -0400 Subject: [PATCH 08/17] Future is not send. --- src/command/build/runner.rs | 2 +- src/command/build/walk_fs.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 4bf1ade..a36c9af 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -61,7 +61,7 @@ async fn get_output_directory(config: &Config) -> Result { Ok(output_directory) } -fn filter_to_post_directories(entry: &DirEntry) -> Result { +async fn filter_to_post_directories(entry: &DirEntry) -> Result { Ok(true) } diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index a214941..0361a70 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -1,3 +1,4 @@ +use std::future::Future; use std::ops::AsyncFn; use std::path::Path; @@ -9,7 +10,10 @@ use crate::error::CustomError; pub(crate) fn walk_fs<'p, P: AsRef + std::marker::Send + 'p>( root: P, - predicate: fn(&DirEntry) -> Result, + predicate: impl AsyncFn(&DirEntry) -> Result + + std::marker::Send + + 'p + + std::marker::Copy, ) -> BoxFuture<'p, Result, CustomError>> { async move { let mut ret = Vec::new(); @@ -20,7 +24,7 @@ pub(crate) fn walk_fs<'p, P: AsRef + std::marker::Send + 'p>( let child_entries = walk_fs(entry.path(), predicate).await?; ret.extend(child_entries); } - if predicate(&entry)? { + if predicate(&entry).await? { ret.push(entry); } } From 493adb4688d445d52e1227eb03dce31d274b3741 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 16:15:23 -0400 Subject: [PATCH 09/17] Switch to iterative instead of recursive. --- src/command/build/runner.rs | 16 +++++++-- src/command/build/walk_fs.rs | 66 +++++++++++++++++++++++------------- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index a36c9af..b9fe1b7 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -5,6 +5,7 @@ use std::sync::Mutex; use super::stylesheet::Stylesheet; use super::walk_fs::walk_fs; +use super::walk_fs::WalkAction; use crate::cli::parameters::BuildArgs; use crate::command::build::render::SiteRenderer; use crate::config::Config; @@ -61,12 +62,21 @@ async fn get_output_directory(config: &Config) -> Result { Ok(output_directory) } -async fn filter_to_post_directories(entry: &DirEntry) -> Result { - Ok(true) +async fn filter_to_highest_folders_containing_org_files( + entry: &DirEntry, +) -> Result { + let file_type = entry.file_type().await?; + let mut entries = tokio::fs::read_dir(entry.path()).await?; + + todo!() } async fn get_post_directories(config: &Config) -> Result, CustomError> { - walk_fs(config.get_posts_directory(), filter_to_post_directories).await?; + walk_fs( + config.get_posts_directory(), + filter_to_highest_folders_containing_org_files, + ) + .await?; let mut ret = Vec::new(); if !config.get_posts_directory().exists() { diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index 0361a70..cf20661 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -1,35 +1,53 @@ -use std::future::Future; +use std::collections::VecDeque; use std::ops::AsyncFn; -use std::path::Path; +use std::path::PathBuf; -use futures::future::BoxFuture; -use futures::FutureExt; use tokio::fs::DirEntry; use crate::error::CustomError; -pub(crate) fn walk_fs<'p, P: AsRef + std::marker::Send + 'p>( +pub(crate) async fn walk_fs< + P: Into, + F: AsyncFn(&DirEntry) -> Result, +>( root: P, - predicate: impl AsyncFn(&DirEntry) -> Result - + std::marker::Send - + 'p - + std::marker::Copy, -) -> BoxFuture<'p, Result, CustomError>> { - async move { - let mut ret = Vec::new(); - let mut entries = tokio::fs::read_dir(root).await?; + filter: F, +) -> Result, CustomError> { + let mut ret = Vec::new(); + let mut backlog = VecDeque::new(); + backlog.push_back(root.into()); + while let Some(p) = backlog.pop_front() { + let mut entries = tokio::fs::read_dir(p).await?; while let Some(entry) = entries.next_entry().await? { - let file_type = entry.file_type().await?; - if file_type.is_dir() { - let child_entries = walk_fs(entry.path(), predicate).await?; - ret.extend(child_entries); - } - if predicate(&entry).await? { - ret.push(entry); - } + let action = filter(&entry).await?; + match action { + WalkAction::HaltAndCapture => { + ret.push(entry); + } + WalkAction::Halt => {} + WalkAction::RecurseAndCapture => { + backlog.push_back(entry.path()); + ret.push(entry); + } + WalkAction::Recurse => { + backlog.push_back(entry.path()); + } + }; } - - Ok(ret) } - .boxed() + Ok(ret) +} + +pub(crate) enum WalkAction { + /// Do not walk down this path but add it to the return list. + HaltAndCapture, + + /// Do not walk down this path and do not add it to the return list. + Halt, + + /// Walk down this path and add it to the return list. + RecurseAndCapture, + + /// Walk down this path but do not add it to the return list. + Recurse, } From b9f74b7eca18af4a6b2e29c3a35be48943e94efb Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 16:25:54 -0400 Subject: [PATCH 10/17] Write the filter to find the highest folders containing org documents. --- src/command/build/runner.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index b9fe1b7..9b9b8c3 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -66,13 +66,27 @@ async fn filter_to_highest_folders_containing_org_files( entry: &DirEntry, ) -> Result { let file_type = entry.file_type().await?; + if !file_type.is_dir() { + return Ok(WalkAction::Halt); + } let mut entries = tokio::fs::read_dir(entry.path()).await?; - - todo!() + while let Some(entry) = entries.next_entry().await? { + let entry_type = entry.file_type().await?; + if !entry_type.is_file() { + continue; + } + match entry.path().extension().and_then(OsStr::to_str) { + Some("org") => { + return Ok(WalkAction::HaltAndCapture); + } + _ => {} + } + } + Ok(WalkAction::Recurse) } async fn get_post_directories(config: &Config) -> Result, CustomError> { - walk_fs( + let top_level_org_folders = walk_fs( config.get_posts_directory(), filter_to_highest_folders_containing_org_files, ) From c5621212bcba45c9b479670c90a85e13c99f0ca6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 16:35:45 -0400 Subject: [PATCH 11/17] Using multi-level deep folders successfully but the output is still shallow. --- src/command/build/runner.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 9b9b8c3..368f57b 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -86,24 +86,19 @@ async fn filter_to_highest_folders_containing_org_files( } async fn get_post_directories(config: &Config) -> Result, CustomError> { + if !config.get_posts_directory().exists() { + return Ok(Vec::new()); + } + let top_level_org_folders = walk_fs( config.get_posts_directory(), filter_to_highest_folders_containing_org_files, ) .await?; - - let mut ret = Vec::new(); - if !config.get_posts_directory().exists() { - return Ok(ret); - } - let mut entries = tokio::fs::read_dir(config.get_posts_directory()).await?; - while let Some(entry) = entries.next_entry().await? { - let file_type = entry.file_type().await?; - if file_type.is_dir() { - ret.push(entry.path()); - } - } - Ok(ret) + Ok(top_level_org_folders + .into_iter() + .map(|entry| entry.path()) + .collect()) } async fn load_blog_posts(config: &Config) -> Result, CustomError> { From 8ab69e480e063ab27ade627fade4239b26f12044 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 16:38:29 -0400 Subject: [PATCH 12/17] Case insensitive match for org file extension. --- src/command/build/runner.rs | 2 +- src/command/build/walk_fs.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 368f57b..f184be9 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -76,7 +76,7 @@ async fn filter_to_highest_folders_containing_org_files( continue; } match entry.path().extension().and_then(OsStr::to_str) { - Some("org") => { + Some(ext) if ext.eq_ignore_ascii_case("org") => { return Ok(WalkAction::HaltAndCapture); } _ => {} diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index cf20661..287cbf4 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -46,6 +46,7 @@ pub(crate) enum WalkAction { Halt, /// Walk down this path and add it to the return list. + #[allow(dead_code)] RecurseAndCapture, /// Walk down this path but do not add it to the return list. From 379850fe3d0e1f349f320fb2abffbb45d4918d4f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 16:55:38 -0400 Subject: [PATCH 13/17] Use the deep path as the post id. --- src/command/build/runner.rs | 11 ++++++++--- src/intermediate/blog_post.rs | 15 +++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index f184be9..20b57b5 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -103,10 +103,15 @@ async fn get_post_directories(config: &Config) -> Result, CustomErr async fn load_blog_posts(config: &Config) -> Result, CustomError> { let root_directory = config.get_root_directory().to_owned(); + let posts_directory = config.get_posts_directory(); let post_directories = get_post_directories(config).await?; - let load_jobs = post_directories - .into_iter() - .map(|path| tokio::spawn(BlogPost::load_blog_post(root_directory.clone(), path))); + let load_jobs = post_directories.into_iter().map(|path| { + tokio::spawn(BlogPost::load_blog_post( + root_directory.clone(), + posts_directory.clone(), + path, + )) + }); let mut blog_posts = Vec::new(); for job in load_jobs { blog_posts.push(job.await??); diff --git a/src/intermediate/blog_post.rs b/src/intermediate/blog_post.rs index da3a374..01f8d08 100644 --- a/src/intermediate/blog_post.rs +++ b/src/intermediate/blog_post.rs @@ -20,14 +20,17 @@ pub(crate) struct BlogPost { } impl BlogPost { - pub(crate) async fn load_blog_post, R: AsRef>( + pub(crate) async fn load_blog_post, R: AsRef, S: AsRef>( root_dir: R, + posts_dir: S, post_dir: P, ) -> Result { - async fn inner(_root_dir: &Path, post_dir: &Path) -> Result { - let post_id = post_dir - .file_name() - .expect("The post directory should have a name."); + async fn inner( + _root_dir: &Path, + posts_dir: &Path, + post_dir: &Path, + ) -> Result { + let post_id = post_dir.strip_prefix(posts_dir)?.as_os_str(); let org_files = { let mut ret = Vec::new(); @@ -80,7 +83,7 @@ impl BlogPost { pages, }) } - inner(root_dir.as_ref(), post_dir.as_ref()).await + inner(root_dir.as_ref(), posts_dir.as_ref(), post_dir.as_ref()).await } /// Get the date for a blog post. From 7ddc4011b3185f349f7fd2020dbf88310c79c3e6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:03:52 -0400 Subject: [PATCH 14/17] Use a type alias for read file results. --- src/command/build/render.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 530fba1..ef0a1aa 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -263,9 +263,11 @@ fn build_name_contents_pairs<'a>( Ok((name, contents)) } +type ReadFileResult = std::io::Result<(PathBuf, Vec)>; + fn get_all_files>( root_dir: P, -) -> Result)>>>, walkdir::Error> { +) -> Result>, walkdir::Error> { let files = WalkDir::new(root_dir) .into_iter() .filter(|e| match e { @@ -280,7 +282,7 @@ fn get_all_files>( Ok(org_files) } -async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, Vec)> { +async fn read_file(path: PathBuf) -> ReadFileResult { let contents = tokio::fs::read(&path).await?; Ok((path, contents)) } From 2081d25066209e39bfdc3fe84c26f33931e9f9cb Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:14:05 -0400 Subject: [PATCH 15/17] Remove a use of WalkDir. --- src/command/build/render.rs | 38 ++++++++++++++++++++++-------------- src/command/build/runner.rs | 5 ++--- src/command/build/walk_fs.rs | 7 +++---- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/command/build/render.rs b/src/command/build/render.rs index ef0a1aa..eee6257 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -4,8 +4,8 @@ use std::path::PathBuf; use include_dir::include_dir; use include_dir::Dir; +use tokio::fs::DirEntry; use tokio::task::JoinHandle; -use walkdir::WalkDir; use crate::config::Config; use crate::context::RenderBlogPostPage; @@ -22,6 +22,9 @@ use crate::render::DusterRenderer; use crate::render::RendererIntegration; use super::stylesheet::Stylesheet; +use super::walk_fs::walk_fs; +use super::walk_fs::WalkAction; +use super::walk_fs::WalkFsFilterResult; static MAIN_TEMPLATES: Dir = include_dir!("$CARGO_MANIFEST_DIR/default_environment/templates/html"); @@ -235,7 +238,7 @@ impl SiteRenderer { if !static_files_directory.exists() { return Ok(()); } - let static_files = get_all_files(&static_files_directory)?; + let static_files = get_all_files(&static_files_directory).await?; for entry in static_files { let (path, contents) = entry.await??; let relative_path = path.strip_prefix(&static_files_directory)?; @@ -265,21 +268,26 @@ fn build_name_contents_pairs<'a>( type ReadFileResult = std::io::Result<(PathBuf, Vec)>; -fn get_all_files>( +async fn filter_to_files(entry: &DirEntry) -> WalkFsFilterResult { + let file_type = entry.file_type().await?; + if file_type.is_dir() { + return Ok(WalkAction::Recurse); + } + if file_type.is_file() { + return Ok(WalkAction::HaltAndCapture); + } + + unreachable!("Unhandled file type."); +} + +async fn get_all_files>( root_dir: P, -) -> Result>, walkdir::Error> { - let files = WalkDir::new(root_dir) +) -> Result>, CustomError> { + let files = walk_fs(root_dir.as_ref(), filter_to_files).await?; + let files_and_content = files .into_iter() - .filter(|e| match e { - Ok(dir_entry) => dir_entry.file_type().is_file(), - Err(_) => true, - }) - .collect::, _>>()?; - let org_files = files - .into_iter() - .map(walkdir::DirEntry::into_path) - .map(|path| tokio::spawn(read_file(path))); - Ok(org_files) + .map(|entry| tokio::spawn(read_file(entry.path()))); + Ok(files_and_content) } async fn read_file(path: PathBuf) -> ReadFileResult { diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 20b57b5..51e7fec 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -6,6 +6,7 @@ use std::sync::Mutex; use super::stylesheet::Stylesheet; use super::walk_fs::walk_fs; use super::walk_fs::WalkAction; +use super::walk_fs::WalkFsFilterResult; use crate::cli::parameters::BuildArgs; use crate::command::build::render::SiteRenderer; use crate::config::Config; @@ -62,9 +63,7 @@ async fn get_output_directory(config: &Config) -> Result { Ok(output_directory) } -async fn filter_to_highest_folders_containing_org_files( - entry: &DirEntry, -) -> Result { +async fn filter_to_highest_folders_containing_org_files(entry: &DirEntry) -> WalkFsFilterResult { let file_type = entry.file_type().await?; if !file_type.is_dir() { return Ok(WalkAction::Halt); diff --git a/src/command/build/walk_fs.rs b/src/command/build/walk_fs.rs index 287cbf4..6cf9724 100644 --- a/src/command/build/walk_fs.rs +++ b/src/command/build/walk_fs.rs @@ -6,10 +6,9 @@ use tokio::fs::DirEntry; use crate::error::CustomError; -pub(crate) async fn walk_fs< - P: Into, - F: AsyncFn(&DirEntry) -> Result, ->( +pub(crate) type WalkFsFilterResult = Result; + +pub(crate) async fn walk_fs, F: AsyncFn(&DirEntry) -> WalkFsFilterResult>( root: P, filter: F, ) -> Result, CustomError> { From 1c3e2ca4d97be13f0361fdf59f62b286d4de81df Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:26:37 -0400 Subject: [PATCH 16/17] Remove the last use of walkdir. --- Cargo.lock | 1 - Cargo.toml | 1 - src/command/build/mod.rs | 1 - src/command/build/render.rs | 6 ++-- src/command/build/runner.rs | 8 ++--- src/error/error.rs | 7 ----- src/intermediate/blog_post.rs | 47 ++++++++++++++++++------------ src/main.rs | 1 + src/{command/build => }/walk_fs.rs | 0 9 files changed, 37 insertions(+), 35 deletions(-) rename src/{command/build => }/walk_fs.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 34c66d7..c1bd77d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,7 +446,6 @@ dependencies = [ "tokio", "toml", "url", - "walkdir", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9010954..47d1263 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ serde_json = "1.0.107" tokio = { version = "1.30.0", default-features = false, features = ["rt", "rt-multi-thread", "fs", "io-util"] } toml = "0.8.2" url = "2.5.0" -walkdir = "2.4.0" # Optimized build for any sort of release. [profile.release-lto] diff --git a/src/command/build/mod.rs b/src/command/build/mod.rs index 6b8fd66..b1b161e 100644 --- a/src/command/build/mod.rs +++ b/src/command/build/mod.rs @@ -1,6 +1,5 @@ mod render; mod runner; mod stylesheet; -mod walk_fs; pub(crate) use runner::build_site; diff --git a/src/command/build/render.rs b/src/command/build/render.rs index eee6257..6ffb7d8 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -20,11 +20,11 @@ use crate::intermediate::BlogPost; use crate::intermediate::IPage; use crate::render::DusterRenderer; use crate::render::RendererIntegration; +use crate::walk_fs::walk_fs; +use crate::walk_fs::WalkAction; +use crate::walk_fs::WalkFsFilterResult; use super::stylesheet::Stylesheet; -use super::walk_fs::walk_fs; -use super::walk_fs::WalkAction; -use super::walk_fs::WalkFsFilterResult; static MAIN_TEMPLATES: Dir = include_dir!("$CARGO_MANIFEST_DIR/default_environment/templates/html"); diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index 51e7fec..a4aa01b 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -4,9 +4,6 @@ use std::sync::Arc; use std::sync::Mutex; use super::stylesheet::Stylesheet; -use super::walk_fs::walk_fs; -use super::walk_fs::WalkAction; -use super::walk_fs::WalkFsFilterResult; use crate::cli::parameters::BuildArgs; use crate::command::build::render::SiteRenderer; use crate::config::Config; @@ -17,6 +14,9 @@ use crate::intermediate::IPage; use crate::intermediate::IntermediateContext; use crate::intermediate::PageInput; use crate::intermediate::Registry; +use crate::walk_fs::walk_fs; +use crate::walk_fs::WalkAction; +use crate::walk_fs::WalkFsFilterResult; use include_dir::include_dir; use include_dir::Dir; use tokio::fs::DirEntry; @@ -125,7 +125,7 @@ async fn load_pages(config: &Config) -> Result, CustomError> { if !pages_source.exists() { return Ok(Vec::new()); } - let page_files = get_org_files(&pages_source)?; + let page_files = get_org_files(&pages_source).await?; let org_files = { let mut ret = Vec::new(); for page in page_files { diff --git a/src/error/error.rs b/src/error/error.rs index 73d08ef..a11e69f 100644 --- a/src/error/error.rs +++ b/src/error/error.rs @@ -8,7 +8,6 @@ pub(crate) enum CustomError { IO(#[allow(dead_code)] std::io::Error), TomlSerialize(#[allow(dead_code)] toml::ser::Error), TomlDeserialize(#[allow(dead_code)] toml::de::Error), - WalkDir(#[allow(dead_code)] walkdir::Error), Tokio(#[allow(dead_code)] tokio::task::JoinError), Serde(#[allow(dead_code)] serde_json::Error), Utf8(#[allow(dead_code)] Utf8Error), @@ -49,12 +48,6 @@ impl From for CustomError { } } -impl From for CustomError { - fn from(value: walkdir::Error) -> Self { - CustomError::WalkDir(value) - } -} - impl From for CustomError { fn from(value: tokio::task::JoinError) -> Self { CustomError::Tokio(value) diff --git a/src/intermediate/blog_post.rs b/src/intermediate/blog_post.rs index 01f8d08..6f48864 100644 --- a/src/intermediate/blog_post.rs +++ b/src/intermediate/blog_post.rs @@ -3,13 +3,16 @@ use std::path::PathBuf; use std::sync::Arc; use std::sync::Mutex; +use tokio::fs::DirEntry; use tokio::task::JoinHandle; -use walkdir::WalkDir; use crate::error::CustomError; use crate::intermediate::blog_post_page::BlogPostPageInput; use crate::intermediate::registry::Registry; use crate::intermediate::IntermediateContext; +use crate::walk_fs::walk_fs; +use crate::walk_fs::WalkAction; +use crate::walk_fs::WalkFsFilterResult; use super::BlogPostPage; @@ -34,7 +37,7 @@ impl BlogPost { let org_files = { let mut ret = Vec::new(); - let org_files_iter = get_org_files(post_dir)?; + let org_files_iter = get_org_files(post_dir).await?; for entry in org_files_iter { ret.push(entry.await??); } @@ -122,25 +125,33 @@ async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> { Ok((path, contents)) } -pub(crate) fn get_org_files>( +pub(crate) async fn get_org_files>( root_dir: P, -) -> Result>>, walkdir::Error> { - let org_files = WalkDir::new(root_dir) - .into_iter() - .filter(|e| match e { - Ok(dir_entry) => { - dir_entry.file_type().is_file() - && Path::new(dir_entry.file_name()) - .extension() - .map(|ext| ext.to_ascii_lowercase() == "org") - .unwrap_or(false) - } - Err(_) => true, - }) - .collect::, _>>()?; +) -> Result>>, CustomError> { + let org_files = walk_fs(root_dir.as_ref(), filter_to_org_files).await?; let org_files = org_files .into_iter() - .map(walkdir::DirEntry::into_path) + .map(|entry| entry.path()) .map(|path| tokio::spawn(read_file(path))); Ok(org_files) } + +async fn filter_to_org_files(entry: &DirEntry) -> WalkFsFilterResult { + let file_type = entry.file_type().await?; + if file_type.is_dir() { + return Ok(WalkAction::Recurse); + } + if file_type.is_file() { + if entry + .path() + .extension() + .map(|ext| ext.eq_ignore_ascii_case("org")) + .unwrap_or(false) + { + return Ok(WalkAction::HaltAndCapture); + } + return Ok(WalkAction::Halt); + } + + unreachable!("Unhandled file type."); +} diff --git a/src/main.rs b/src/main.rs index 09fb643..bbe13c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,7 @@ mod context; mod error; mod intermediate; mod render; +mod walk_fs; fn main() -> Result { let rt = tokio::runtime::Runtime::new()?; diff --git a/src/command/build/walk_fs.rs b/src/walk_fs.rs similarity index 100% rename from src/command/build/walk_fs.rs rename to src/walk_fs.rs From 884a28e63adf3c3fcef84e73c425d2630c62fd82 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:28:50 -0400 Subject: [PATCH 17/17] Remove pointless copying. --- src/command/build/render.rs | 5 ++--- src/intermediate/blog_post.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 6ffb7d8..5108ccd 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -1,5 +1,4 @@ use std::ffi::OsStr; -use std::path::Path; use std::path::PathBuf; use include_dir::include_dir; @@ -280,10 +279,10 @@ async fn filter_to_files(entry: &DirEntry) -> WalkFsFilterResult { unreachable!("Unhandled file type."); } -async fn get_all_files>( +async fn get_all_files>( root_dir: P, ) -> Result>, CustomError> { - let files = walk_fs(root_dir.as_ref(), filter_to_files).await?; + let files = walk_fs(root_dir, filter_to_files).await?; let files_and_content = files .into_iter() .map(|entry| tokio::spawn(read_file(entry.path()))); diff --git a/src/intermediate/blog_post.rs b/src/intermediate/blog_post.rs index 6f48864..adb8ac2 100644 --- a/src/intermediate/blog_post.rs +++ b/src/intermediate/blog_post.rs @@ -125,10 +125,10 @@ async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> { Ok((path, contents)) } -pub(crate) async fn get_org_files>( +pub(crate) async fn get_org_files>( root_dir: P, ) -> Result>>, CustomError> { - let org_files = walk_fs(root_dir.as_ref(), filter_to_org_files).await?; + let org_files = walk_fs(root_dir, filter_to_org_files).await?; let org_files = org_files .into_iter() .map(|entry| entry.path())