Merge "Update mockall to 0.13.1" into main
diff --git a/crates/argh_shared/.android-checksum.json b/crates/argh_shared/.android-checksum.json
index 24bb8b1..a89e96e 100644
--- a/crates/argh_shared/.android-checksum.json
+++ b/crates/argh_shared/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"faa2703196aae6b28af0aaf4d44d48293f9a6c7f418cce923957ee2922fdc53b","Android.bp":"051a6127f3bf3b88e72b1d2a01a2924ec1c458d8d6d23be0559097616c411d4c","Cargo.toml":"7eff2740e789eb32621979c24987271770e14c2f005d254006dbc7ea0b363f78","LICENSE":"2d317525712f72bc5bd06a826df2bb2a6de216a9b1dcc8a423e7432c9b92c4a3","METADATA":"484ab152a2ad20ca33eb3e2c1e24615264f03bb475f15a92f7359e9a3724a80e","MODULE_LICENSE_BSD":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"aae203330dcae6321e20e651bf256dcbda6ef30c082189625c089b5a323555f9","TEST_MAPPING":"c05e28a9bd796694b7b14a5bee1fc17b976d36cba94f87f4c3a325ad61cfe8cc","cargo_embargo.json":"4534efdc4dd17000b31998823b78b690b19ae79fabf7419df626a79ba7141890","src/lib.rs":"7a8c27b66fc9378c41590e88958b3cd268859e3efd99c01683ed482623ebc751"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"62f3f1ae9f1076a7170cd38d6a7079447827e207620b18f19f0f557620b0a333","Android.bp":"99750ef9f6ece7fa1151f444852713aee41e79fd228c2710e46a7592e965e140","Cargo.toml":"76cbcd80fcaaaa4e08253f3658f00eb0db5cbff022c4b78a40be178d953039fc","LICENSE":"2d317525712f72bc5bd06a826df2bb2a6de216a9b1dcc8a423e7432c9b92c4a3","METADATA":"358da0fc84355223f0ea89cead375fbda71df23fb873758d0fe19a02ce5432cf","MODULE_LICENSE_BSD":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"f3766c596e66441272fcf1e0fe590ada79e5c9f8cfe7d0bcdf94f2699760a45b","TEST_MAPPING":"c05e28a9bd796694b7b14a5bee1fc17b976d36cba94f87f4c3a325ad61cfe8cc","cargo_embargo.json":"4534efdc4dd17000b31998823b78b690b19ae79fabf7419df626a79ba7141890","src/lib.rs":"bc9b694adf11a6afeefc167e22e42d720a933277a96f65caf9c818189f974b03"}}
\ No newline at end of file
diff --git a/crates/argh_shared/.cargo-checksum.json b/crates/argh_shared/.cargo-checksum.json
index fbbf092..f19d223 100644
--- a/crates/argh_shared/.cargo-checksum.json
+++ b/crates/argh_shared/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"0815c9ae5449d9129081a3b98215b0e9896d95ed6e67e02b81c6c11b08cb4a73","LICENSE":"03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b","README.md":"05bee47456d4e08e89cb73dbd74cf8a2e1a96a896b9ec5c10842422282b539a2","src/lib.rs":"93a69c60f0d9f468127e0c2d0416370e303adf82204b4971476ecbc0c6994a09"},"package":"5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531"}
\ No newline at end of file
+{"files":{"Cargo.toml":"794c97c4880f0dc9f7e40801104381b9ea2adf6f7800b35ea49d778a87caeddd","LICENSE":"03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b","README.md":"fcf5bcc13c309045c66a509d8cb107305b82c8728bfe44e2106cd3ca80e83107","src/lib.rs":"20b6b27542691f5bc14652bf6847b7a17e5de59a37758522f6c4ca42a705b6d7"},"package":"a464143cc82dedcdc3928737445362466b7674b5db4e2eb8e869846d6d84f4f6"}
\ No newline at end of file
diff --git a/crates/argh_shared/Android.bp b/crates/argh_shared/Android.bp
index fa02777..663343f 100644
--- a/crates/argh_shared/Android.bp
+++ b/crates/argh_shared/Android.bp
@@ -18,10 +18,9 @@
host_supported: true,
crate_name: "argh_shared",
cargo_env_compat: true,
- cargo_pkg_version: "0.1.12",
+ cargo_pkg_version: "0.1.13",
crate_root: "src/lib.rs",
edition: "2018",
- rustlibs: ["libserde"],
apex_available: [
"//apex_available:platform",
"com.android.virt",
diff --git a/crates/argh_shared/Cargo.toml b/crates/argh_shared/Cargo.toml
index 2463da8..983fc78 100644
--- a/crates/argh_shared/Cargo.toml
+++ b/crates/argh_shared/Cargo.toml
@@ -12,17 +12,28 @@
[package]
edition = "2018"
name = "argh_shared"
-version = "0.1.12"
+version = "0.1.13"
authors = [
"Taylor Cramer <[email protected]>",
"Benjamin Brittain <[email protected]>",
"Erick Tryzelaar <[email protected]>",
]
+build = false
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = "Derive-based argument parsing optimized for code size"
readme = "README.md"
license = "BSD-3-Clause"
repository = "https://github.com/google/argh"
+[lib]
+name = "argh_shared"
+path = "src/lib.rs"
+
[dependencies.serde]
version = "1"
features = ["derive"]
+optional = true
diff --git a/crates/argh_shared/METADATA b/crates/argh_shared/METADATA
index ee3b7ee..402b518 100644
--- a/crates/argh_shared/METADATA
+++ b/crates/argh_shared/METADATA
@@ -1,17 +1,17 @@
name: "argh_shared"
description: "Derive-based argument parsing optimized for code size"
third_party {
- version: "0.1.12"
+ version: "0.1.13"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 10
- day: 19
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/argh_shared"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/argh_shared/argh_shared-0.1.12.crate"
- version: "0.1.12"
+ value: "https://static.crates.io/crates/argh_shared/argh_shared-0.1.13.crate"
+ version: "0.1.13"
}
}
diff --git a/crates/argh_shared/README.md b/crates/argh_shared/README.md
index 7368162..8a03f94 100644
--- a/crates/argh_shared/README.md
+++ b/crates/argh_shared/README.md
@@ -51,7 +51,7 @@
-j, --jump whether or not to jump
--height how high to go
--pilot-nickname an optional nickname for the pilot
- --help display usage information
+ --help, help display usage information
```
The resulting program can then be used in any of these ways:
diff --git a/crates/argh_shared/src/lib.rs b/crates/argh_shared/src/lib.rs
index 20383a4..ae44e5b 100644
--- a/crates/argh_shared/src/lib.rs
+++ b/crates/argh_shared/src/lib.rs
@@ -15,7 +15,8 @@
}
/// Information about the command line arguments for a given command.
-#[derive(Debug, Default, PartialEq, Eq, Clone, serde::Serialize)]
+#[derive(Debug, Default, PartialEq, Eq, Clone)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct CommandInfoWithArgs<'a> {
/// The name of the command.
pub name: &'a str,
@@ -36,7 +37,8 @@
}
/// Information about a documented error code.
-#[derive(Debug, PartialEq, Eq, serde::Serialize)]
+#[derive(Debug, PartialEq, Eq)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct ErrorCodeInfo<'a> {
/// The code value.
pub code: i32,
@@ -45,7 +47,8 @@
}
/// Information about positional arguments
-#[derive(Debug, PartialEq, Eq, serde::Serialize)]
+#[derive(Debug, PartialEq, Eq)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct PositionalInfo<'a> {
/// Name of the argument.
pub name: &'a str,
@@ -63,7 +66,8 @@
/// Dynamic subcommands do not implement
/// get_args_info(), so the command field
/// only contains the name and description.
-#[derive(Debug, Default, PartialEq, Eq, Clone, serde::Serialize)]
+#[derive(Debug, Default, PartialEq, Eq, Clone)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct SubCommandInfo<'a> {
/// The subcommand name.
pub name: &'a str,
@@ -72,7 +76,8 @@
}
/// Information about a flag or option.
-#[derive(Debug, Default, PartialEq, Eq, serde::Serialize)]
+#[derive(Debug, Default, PartialEq, Eq)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct FlagInfo<'a> {
/// The kind of flag.
pub kind: FlagInfoKind<'a>,
@@ -81,7 +86,7 @@
/// The long string of the flag.
pub long: &'a str,
/// The single character short indicator
- /// for trhis flag.
+ /// for this flag.
pub short: Option<char>,
/// The description of the flag.
pub description: &'a str,
@@ -92,7 +97,8 @@
}
/// The kind of flags.
-#[derive(Debug, Default, PartialEq, Eq, serde::Serialize)]
+#[derive(Debug, Default, PartialEq, Eq)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub enum FlagInfoKind<'a> {
/// switch represents a boolean flag,
#[default]
@@ -102,9 +108,10 @@
Option { arg_name: &'a str },
}
-/// The optionality defines the requirments related
+/// The optionality defines the requirements related
/// to the presence of the argument on the command line.
-#[derive(Debug, Default, PartialEq, Eq, serde::Serialize)]
+#[derive(Debug, Default, PartialEq, Eq)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub enum Optionality {
/// Required indicates the argument is required
/// exactly once.
@@ -117,7 +124,7 @@
/// or more times.
Repeating,
/// Greedy is used for positional arguments which
- /// capture the all command line input upto the next flag or
+ /// capture the all command line input up to the next flag or
/// the end of the input.
Greedy,
}
diff --git a/crates/bitflags/.android-checksum.json b/crates/bitflags/.android-checksum.json
index feaa531..cc854d0 100644
--- a/crates/bitflags/.android-checksum.json
+++ b/crates/bitflags/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"340b17e46fea0170842dccfa0339bcb50271e5c516e664c9edaf6dc147993988","Android.bp":"131a767bcc4a59a5cfcf36673fe4c8841957c1e2b6d60e1002c5134f6bf6db0c","CHANGELOG.md":"5e0f6921421101104d88e8797a2ce6a621b9503e681573a24278d3a3596acf5b","CODE_OF_CONDUCT.md":"4063df77c169eee901088338d4c4fdb1523469263a6e4ab46e2936d9ed1d8287","CONTRIBUTING.md":"eefc979a5fed613f39b33128b1a3acdb31bc12fbd2aa70bc0bd37afe9d0c4263","Cargo.lock":"d4e6fabb5fc6102d01483b6d076ba9efc0836ea614f4272a9e3d2277a40e4dcf","Cargo.toml":"1320ac34c24b7f6d7bbcd7f9afc61987c9d51ee84e215beeabe209bfe8760bc1","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"1ae6e6b8fff5925aa71251fbd6f7b3f5f88e2b1c5f4d4c4409406ec02990304f","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"94ad5dc0fb23c99e57ec477e15aab41595b23f3830e34d9e8cc54739ed0b680e","SECURITY.md":"b4054da2c6cf71c5c262d4e1ea23fe4a34fbaff429c837ef9cc1987050b0799a","TEST_MAPPING":"bcbfeb9a73a2e8a24ce7bc6e2529132de16e557957825acbac0dc616b1bb71c4","benches/parse.rs":"a2803b852ff337f7fd999602ba2a2963d57bfc7a63e619d4770e39a3bbe452e9","cargo_embargo.json":"d2d75aec1339e081ddf5bd585b4bf41d71c15afb1ec279e36b9de768475674c7","examples/custom_bits_type.rs":"65b3b831bbaf36201abf9ff48aa0424631a97c49a10c51d254a3f49f3f74753a","examples/custom_derive.rs":"7d08522687aeb3d449398bb98531dc10454123e6d5c665c82bbadb3198e704eb","examples/fmt.rs":"b49642ac253df177baa32a806df6f6a60c598bb08c5ca3a1589daa900fa6935b","examples/macro_free.rs":"276c152ee5cdad71a3988705abda355e54a6d467b465683fa7ee77e84fbb0623","examples/serde.rs":"e35659978f11469a7519402971ee0a37fec052e5b4f8f2f58b44ddf5bc4dab55","patches/rules.mk.diff":"38a0d80f966cc4413dff0c924a3cb5311804d835111e0dafa1054431b0277c14","rules.mk":"a9f1aaf7b85c9270b663e1eba553b4d4c498d3bf163265767869219b9a7f15b5","spec.md":"d6ac0c32ef98f96df3634e38d0bad97420126af3fd2e9eec008044a3d63d24c8","src/example_generated.rs":"e0b32b40b22248a2731106bd851a9eb2410b4774a72fc89838b4fbb7c6e393a3","src/external.rs":"300a572fadfe6d1fb05c81183c90de01b8ab923e7df82585ff7da0af0dfabc89","src/external/arbitrary.rs":"e22013b2cb04babe3de5c8b7a86a371084d10e1bfcbe94a06d3e5de7ca6867ce","src/external/bytemuck.rs":"290281ecc027b069b72a6e965e23af1b362f70d84a1b6466baae781c42080264","src/external/serde.rs":"25a6360def73c6eaa619520062e76b1073c01bcbc30fb5b3f15da59dff827638","src/internal.rs":"fbd8c745b8ea36f41aa6ceb05624bd4f2f039a627f00044567ef1d1a230f698f","src/iter.rs":"417e4ef92bc69ebb9abc6e205a7fc5d6f66eeba218cb9354990d91e28651c946","src/lib.rs":"5a869ecadae1a601626bcb21d3d69c9c3726faf1fc5911f22a9525ea76f4b658","src/parser.rs":"95e6a65479842e3880507d09c0e9c975233733ca007eaf85c384f86c825be89f","src/public.rs":"e9d62d31ddbb6c4f70b701d22e616102edf8aea2dc08c8292e365f6292641c07","src/tests.rs":"70eec2abc4c4e7ccc815aeae27d26182ac8b8284eec301d0bbed1596c97c4368","src/tests/all.rs":"d0c32ed470d43e53c471af1684d871b3fe282508e1a93d0a6b18ea0fafc5e474","src/tests/bits.rs":"d083ef28822e1c08c520f37905646c599e607089367c5498aa8777422ed717bc","src/tests/complement.rs":"2eff61b3a7aeeec4c47492468f5d5536d837995fcab87031bb1166296ff1c731","src/tests/contains.rs":"44742bd6e1ee60291da959fef103c137f1aa60cd48720d022dcd574a6747de4a","src/tests/difference.rs":"ade15dac713c90cb075ee0770ce5623233ae1ab676373df550df56ab1d2f31a1","src/tests/empty.rs":"18b93fab7194f5d82addeab1a0ad5efaed806727c479a6c233e602fd1eb3c3dd","src/tests/eq.rs":"471005a8132b16a8900e852cf7d9e864c8bbd7bea01954eb0b91c86f43a89950","src/tests/extend.rs":"366e1d59139af88c4cecb49a76ce21b1e82806dce3abaf5d16dcf65dddd2858c","src/tests/flags.rs":"7c4589c2b41a51ab813e9f40fe1b244fa6943f38d5209f68ff4e1d5106f251f6","src/tests/fmt.rs":"c758caa3f4064756d2478d99a2a758939cc44daa7505d33cae095e10532ee6db","src/tests/from_bits.rs":"47dd1bcf78b24f152fc95109fc0c6dc025c9f667aa5e8bc6d8836fc2cd76dc40","src/tests/from_bits_retain.rs":"4dbcc86e042ab0b2560ced3d0d69e1af803437c398dce7f1be906d92dc06c984","src/tests/from_bits_truncate.rs":"d17efb1bad75c5ff259dd97dedd958c87138bf35352964d041b68bcb11f2d45c","src/tests/from_name.rs":"efc39d196633793996b5fb049d700a50972c89326a55e224049b35c222e5e8a7","src/tests/insert.rs":"206adeff2bbbcf19f3b89404cd7aa00de948299dee68bf232d7e13bc4119f0b5","src/tests/intersection.rs":"cccf16199b719504b3893124501da2037cb754eb1c1e11334e953b96c5778b11","src/tests/intersects.rs":"dc96e54f9b3a3d65ab76015e90c4e7a91d9157512ba0315f8ece08bde148accc","src/tests/is_all.rs":"108180331563f5304d21314a7557bf6e9dd88ade94050408b58856e92b8786a5","src/tests/is_empty.rs":"f4717842e4c55b478bd6e3619c007295536ac19510f4b7df8a5569445c1a7e9e","src/tests/iter.rs":"b7143f58a9a3cecbbb3d84dc4292eb27a26fbddf23b9661270481ea7f377ced3","src/tests/parser.rs":"12513ba119618464e61cb624d9f47c5644b3fe5c90f75b451ea5c1287f3876b5","src/tests/remove.rs":"ace949c743f9c0add2964b3f0f59f5a39d1f20228ec3f5084ee93f331f975007","src/tests/symmetric_difference.rs":"d900443b34855527c5e3dae34a15014db12139edd0393b6dafd05120ff44096a","src/tests/union.rs":"3aa62dbcec0fe9c3302c8425b904b12b6fc303e5adfaed8d087dfdd24142c776","src/traits.rs":"37fa7b6c75ff366a8e0ea6e6d8ee4130d4881464bc266269bad9bfca7c592a7d"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"e60168093f0c9ab79c6efa3cd59e878174ef5aeb60a6ca05da54f6ee948e3726","Android.bp":"ca283fc01925086059b5f8d9084b82f3c58a05327b0531939319a035f3373a1a","CHANGELOG.md":"476f3722c29c420f74df236af508fd3c4f8cb30a9573178bf6cafaeee6489ad4","CODE_OF_CONDUCT.md":"4063df77c169eee901088338d4c4fdb1523469263a6e4ab46e2936d9ed1d8287","CONTRIBUTING.md":"eefc979a5fed613f39b33128b1a3acdb31bc12fbd2aa70bc0bd37afe9d0c4263","Cargo.lock":"781445bdb51c2e6d4d85bf0b247485f0d0af3db05d174356b58fedc1f62737f0","Cargo.toml":"34505970ce9f63ccdd77bd4dcd15af21af4d2f68c8adfc8d30ca77f23961b475","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"d7fb7534ddf862ebb5e4dce15ba28ae1c1f7ed74e013b21ddc55db9d3df07997","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"aaf3505f94957b40aececef1cd66dc1f0b1bf807b4d70a9d7206a883f919b297","SECURITY.md":"b4054da2c6cf71c5c262d4e1ea23fe4a34fbaff429c837ef9cc1987050b0799a","TEST_MAPPING":"bcbfeb9a73a2e8a24ce7bc6e2529132de16e557957825acbac0dc616b1bb71c4","benches/parse.rs":"a2803b852ff337f7fd999602ba2a2963d57bfc7a63e619d4770e39a3bbe452e9","cargo_embargo.json":"d2d75aec1339e081ddf5bd585b4bf41d71c15afb1ec279e36b9de768475674c7","examples/custom_bits_type.rs":"65b3b831bbaf36201abf9ff48aa0424631a97c49a10c51d254a3f49f3f74753a","examples/custom_derive.rs":"5221abaeb50bfe867bf0e47c18f16f8613d86c63ceb8e70c3b03ee8a8d75dc72","examples/fmt.rs":"b49642ac253df177baa32a806df6f6a60c598bb08c5ca3a1589daa900fa6935b","examples/macro_free.rs":"276c152ee5cdad71a3988705abda355e54a6d467b465683fa7ee77e84fbb0623","examples/serde.rs":"e35659978f11469a7519402971ee0a37fec052e5b4f8f2f58b44ddf5bc4dab55","patches/rules.mk.diff":"38a0d80f966cc4413dff0c924a3cb5311804d835111e0dafa1054431b0277c14","rules.mk":"a9f1aaf7b85c9270b663e1eba553b4d4c498d3bf163265767869219b9a7f15b5","spec.md":"d6ac0c32ef98f96df3634e38d0bad97420126af3fd2e9eec008044a3d63d24c8","src/example_generated.rs":"e0b32b40b22248a2731106bd851a9eb2410b4774a72fc89838b4fbb7c6e393a3","src/external.rs":"300a572fadfe6d1fb05c81183c90de01b8ab923e7df82585ff7da0af0dfabc89","src/external/arbitrary.rs":"cecc68181620c35419342453ac4c38df7272765d7ff168391a7564c6577b52d5","src/external/bytemuck.rs":"290281ecc027b069b72a6e965e23af1b362f70d84a1b6466baae781c42080264","src/external/serde.rs":"25a6360def73c6eaa619520062e76b1073c01bcbc30fb5b3f15da59dff827638","src/internal.rs":"fbd8c745b8ea36f41aa6ceb05624bd4f2f039a627f00044567ef1d1a230f698f","src/iter.rs":"417e4ef92bc69ebb9abc6e205a7fc5d6f66eeba218cb9354990d91e28651c946","src/lib.rs":"ae8ccdc743d5d99c6e3bd09971519e5b7d9096337dd64adc5163d7c6eafd155a","src/parser.rs":"95e6a65479842e3880507d09c0e9c975233733ca007eaf85c384f86c825be89f","src/public.rs":"e9d62d31ddbb6c4f70b701d22e616102edf8aea2dc08c8292e365f6292641c07","src/tests.rs":"6c4f4ed0937d59b088fc3a947ea20f6ad562a0967c8312bbd3c07d2c02021eba","src/tests/all.rs":"d0c32ed470d43e53c471af1684d871b3fe282508e1a93d0a6b18ea0fafc5e474","src/tests/bits.rs":"d083ef28822e1c08c520f37905646c599e607089367c5498aa8777422ed717bc","src/tests/complement.rs":"2eff61b3a7aeeec4c47492468f5d5536d837995fcab87031bb1166296ff1c731","src/tests/contains.rs":"44742bd6e1ee60291da959fef103c137f1aa60cd48720d022dcd574a6747de4a","src/tests/difference.rs":"ade15dac713c90cb075ee0770ce5623233ae1ab676373df550df56ab1d2f31a1","src/tests/empty.rs":"18b93fab7194f5d82addeab1a0ad5efaed806727c479a6c233e602fd1eb3c3dd","src/tests/eq.rs":"471005a8132b16a8900e852cf7d9e864c8bbd7bea01954eb0b91c86f43a89950","src/tests/extend.rs":"366e1d59139af88c4cecb49a76ce21b1e82806dce3abaf5d16dcf65dddd2858c","src/tests/flags.rs":"7c4589c2b41a51ab813e9f40fe1b244fa6943f38d5209f68ff4e1d5106f251f6","src/tests/fmt.rs":"c758caa3f4064756d2478d99a2a758939cc44daa7505d33cae095e10532ee6db","src/tests/from_bits.rs":"47dd1bcf78b24f152fc95109fc0c6dc025c9f667aa5e8bc6d8836fc2cd76dc40","src/tests/from_bits_retain.rs":"4dbcc86e042ab0b2560ced3d0d69e1af803437c398dce7f1be906d92dc06c984","src/tests/from_bits_truncate.rs":"d17efb1bad75c5ff259dd97dedd958c87138bf35352964d041b68bcb11f2d45c","src/tests/from_name.rs":"efc39d196633793996b5fb049d700a50972c89326a55e224049b35c222e5e8a7","src/tests/insert.rs":"206adeff2bbbcf19f3b89404cd7aa00de948299dee68bf232d7e13bc4119f0b5","src/tests/intersection.rs":"cccf16199b719504b3893124501da2037cb754eb1c1e11334e953b96c5778b11","src/tests/intersects.rs":"dc96e54f9b3a3d65ab76015e90c4e7a91d9157512ba0315f8ece08bde148accc","src/tests/is_all.rs":"108180331563f5304d21314a7557bf6e9dd88ade94050408b58856e92b8786a5","src/tests/is_empty.rs":"f4717842e4c55b478bd6e3619c007295536ac19510f4b7df8a5569445c1a7e9e","src/tests/iter.rs":"b7143f58a9a3cecbbb3d84dc4292eb27a26fbddf23b9661270481ea7f377ced3","src/tests/parser.rs":"12513ba119618464e61cb624d9f47c5644b3fe5c90f75b451ea5c1287f3876b5","src/tests/remove.rs":"ace949c743f9c0add2964b3f0f59f5a39d1f20228ec3f5084ee93f331f975007","src/tests/symmetric_difference.rs":"d900443b34855527c5e3dae34a15014db12139edd0393b6dafd05120ff44096a","src/tests/truncate.rs":"357988c61038edfbb8851dd50ac5f8f7dab5a99d5917c39651d44f83c5d7bb19","src/tests/union.rs":"3aa62dbcec0fe9c3302c8425b904b12b6fc303e5adfaed8d087dfdd24142c776","src/tests/unknown.rs":"52f8a803221065b871b12abfdff590eeeeef71ff3e9422ff1865a64ecf2c686e","src/traits.rs":"0d011a3aac117425f5b1ad657c6ac09275b191f10ec895bb4597e56f23e04378"}}
\ No newline at end of file
diff --git a/crates/bitflags/.cargo-checksum.json b/crates/bitflags/.cargo-checksum.json
index 9ed6cb2..720a2bb 100644
--- a/crates/bitflags/.cargo-checksum.json
+++ b/crates/bitflags/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"c98723b209ac4c66625e034b113a55a43a5c1c9e49c0e3b86123d0cd62bae573","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","CONTRIBUTING.md":"6c9f96eacb20af877ae2d16f024904f3038b93448a8488e9dbcac0df7f6439a5","Cargo.lock":"d3e3bce47b94298f2de893a7d91035f2b73a887905a7ffd4ddb668efdd0aee20","Cargo.toml":"92e110c36340bda13f3b329a2aa24aede8bdcb7fa035806926f7ce438dde87f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"e9b1329fee85868f1aa674d0505cd95b86a259e2a1762347e5af4a5abedd61d4","SECURITY.md":"68704c8128fa2e776ed7cbda741fbf61ad52f998a96350ee7ee4dbf64c6573bc","benches/parse.rs":"f1390d62322c6880d65bd931e183d49b313f287879a6bfaa36b1cb1921090b51","examples/custom_bits_type.rs":"e53b32051adc5d97860e0b48c8f3a301a041d73b4939c0d7caa5f0cfcc0b9739","examples/custom_derive.rs":"a404e8f606efdd1b43e0c365e4142ccc3dc3ba230127ddeea89cd8784bb55a1e","examples/fmt.rs":"87ba37a1fb8528570c74ea26d8e8948e1179c3d867b928bea1080880258e0a99","examples/macro_free.rs":"69e7f284b53b5214d51228a686e87f127b52a3b74711e45537ebfa5583a180e5","examples/serde.rs":"08b21b35d5c10fdca132fe0f36c8067bb44f559e96617a9257ab6316a20cbc75","spec.md":"fcdd939df30c59b0643be09027df664b71cbea9b9989185441482c5576160fed","src/example_generated.rs":"d018caf059f6ffc4c2403b771a6d76679fa5af03c329a91bd9252957df695e7f","src/external.rs":"734d3f470e6a669297d2df421ce3976fe613d8aa9c071d5ce6fe3ca890e5b815","src/external/arbitrary.rs":"fa8c9187028b9bc54856977b0914676f62101010e7a9450abd577fd78c89552f","src/external/bytemuck.rs":"3afcef382122867040fddd5e4153d633d1ed5596fe5d7dfac66a8e61c2513df5","src/external/serde.rs":"4a09db12534a20fe554a08dc5f1c8124b379292d41fa75628abcd2ca21587573","src/internal.rs":"645b13af0c7302258df61239073a4b8203d09f27b6c17f8a6f1f8c3e427f5334","src/iter.rs":"dbaa6437c1c044f689185ce3fafe43df8796bed19bbdd2c20334a52de5eeee73","src/lib.rs":"1feb0eea02f88491c99c7962b0ce6e66bdedea0ab0cac375d4c9c2d879248dc7","src/parser.rs":"4e788b29f5d0542c409a8b43c703bcb4a6c2a57c181cadd17f565f0abb39681e","src/public.rs":"78ba06e1a5830b36960adf9bd79aaf47d783b9b8a0f1fa33b0d7a340c15fd1d1","src/tests.rs":"b120c27ff0c67a819527de9d8171f1f4c5d37ba4009c54abeb869c70e6035f14","src/tests/all.rs":"e99a865cd4271a524c2fe95503e96d851b35990570aed6fb2e9dac7a14da31b6","src/tests/bits.rs":"3840c34b2ea5d1802404b9ce5bcc1d3fa6ccd8dfba2e29e6d07c605f817d90df","src/tests/complement.rs":"d0e6d4c3daf49e0a7438c9f1c1ac91fad1b37f258c03593f6cd6a695ee626f5e","src/tests/contains.rs":"58bb3cb8c86550e775d11134da1d4aca85c83f943ea454e3a5f222772c674a24","src/tests/difference.rs":"d0d2b96bb52658b8ac019210da74ca75a53e76622f668855142ea6e97c28cb0e","src/tests/empty.rs":"817d6e93ced7cb7576ff0e334aa1a44703f3f96871ff2c6bdcb8f207e6551f67","src/tests/eq.rs":"b816767680a029e9c163e37af074dd4e604c4a3e4936f829f0ca3774fd5f0e37","src/tests/extend.rs":"5fabb9fd0254c64da019149c24063fceff72da3eb4ad73b57c1cc4c04b008364","src/tests/flags.rs":"2f48d3a25db1cf66fe98c9959abc70875deb9f7b38b2c278dc70c46e0d4ec277","src/tests/fmt.rs":"a2d4148491f3202f030f63633eee941b741e3be29a68cf376f008dbe5cb11e5c","src/tests/from_bits.rs":"d94c65b88bf89961d0cfc1b3152a7f1acc285bae160a1628438effda11b8e2c1","src/tests/from_bits_retain.rs":"980591dfaf91e940f42d9a1ce890f237514dd59d458fc264abcf9ceabbc40677","src/tests/from_bits_truncate.rs":"d3406b5e107ebb6449b98a59eee6cc5d84f947d4aaee1ee7e80dc7202de179f0","src/tests/from_name.rs":"f4a055d1f3c86decef70ef8f3020cef5c4e229718c20b3d59d5a3abc3a8b1298","src/tests/insert.rs":"3fab5da800a6fc0654dfb5f859f95da65a507eb9fda8695083c2712266dff0b9","src/tests/intersection.rs":"baf1454c9e4eba552264870a556ee0032d9f2bb8cac361833d571235e0b52221","src/tests/intersects.rs":"c55e36179fd8bc636f04ea9bbce346dcaafe57915d13f1df28c5b83117dbd08e","src/tests/is_all.rs":"b2f11faa7c954bd85c8fb39999e0c37d983cf7895152bc13c7ddde106aa33b6d","src/tests/is_empty.rs":"11f21323cdca7ff92dd89e09de667dba69e8dce88e2d3e27ea68ace91d15d070","src/tests/iter.rs":"4ba121932b527e787b82745405c7c65c1084c242e2dda3290d475ec160d265e4","src/tests/parser.rs":"fa2fb8dedcf16601af609a5e21d9c5840c7f96a1e3a587f7f2ea3dc8387f7628","src/tests/remove.rs":"6e75f8508d2dc1a2cba89ef691f4387a665a4fd13853bb1dd0fd80c783b89947","src/tests/symmetric_difference.rs":"0a89f084f9de1dd5b1932fe72c3b10a3c93cbaa16832b3a31b6a85e3bbd3ba6e","src/tests/union.rs":"88f398ee4600bb1e59bf6d02d1f6ff33f5f853eab5a6c700bd8a683c6ee4651a","src/traits.rs":"b79d008daec546136fae4497966fc85a33663d86ea2d9213fd23b412d4d77b66"},"package":"b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"f2635274b6b8c496e855b4cf6ec7852102d794263292fe81f1c088e4ff253716","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","CONTRIBUTING.md":"6c9f96eacb20af877ae2d16f024904f3038b93448a8488e9dbcac0df7f6439a5","Cargo.lock":"6fda29b7daf6af4dc0c5d3f32765e9052192ee960e90f180cdaee3f7f13adca6","Cargo.toml":"f931d505da26360b34271181dcc19b43cf68d11d05514789d24aeb2d814438cc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"4a9814dba6a6fdacf1ad20edd17905375550b2d4dc407ed5f00f2f0597ab437d","SECURITY.md":"68704c8128fa2e776ed7cbda741fbf61ad52f998a96350ee7ee4dbf64c6573bc","benches/parse.rs":"f1390d62322c6880d65bd931e183d49b313f287879a6bfaa36b1cb1921090b51","examples/custom_bits_type.rs":"e53b32051adc5d97860e0b48c8f3a301a041d73b4939c0d7caa5f0cfcc0b9739","examples/custom_derive.rs":"730589695eb68dda21d0d9f69e90cbdbf9823b13d6f16c5f22b0083c00981813","examples/fmt.rs":"87ba37a1fb8528570c74ea26d8e8948e1179c3d867b928bea1080880258e0a99","examples/macro_free.rs":"69e7f284b53b5214d51228a686e87f127b52a3b74711e45537ebfa5583a180e5","examples/serde.rs":"08b21b35d5c10fdca132fe0f36c8067bb44f559e96617a9257ab6316a20cbc75","spec.md":"fcdd939df30c59b0643be09027df664b71cbea9b9989185441482c5576160fed","src/example_generated.rs":"d018caf059f6ffc4c2403b771a6d76679fa5af03c329a91bd9252957df695e7f","src/external.rs":"734d3f470e6a669297d2df421ce3976fe613d8aa9c071d5ce6fe3ca890e5b815","src/external/arbitrary.rs":"43908bb4fe0a076078dcb3fa70c654aaed8c7b38aa66574414165a82037def83","src/external/bytemuck.rs":"3afcef382122867040fddd5e4153d633d1ed5596fe5d7dfac66a8e61c2513df5","src/external/serde.rs":"4a09db12534a20fe554a08dc5f1c8124b379292d41fa75628abcd2ca21587573","src/internal.rs":"645b13af0c7302258df61239073a4b8203d09f27b6c17f8a6f1f8c3e427f5334","src/iter.rs":"dbaa6437c1c044f689185ce3fafe43df8796bed19bbdd2c20334a52de5eeee73","src/lib.rs":"9d571acbfe33d90e61b097ad3bfa821545c67319558365f8d06337504a2d5dfe","src/parser.rs":"4e788b29f5d0542c409a8b43c703bcb4a6c2a57c181cadd17f565f0abb39681e","src/public.rs":"78ba06e1a5830b36960adf9bd79aaf47d783b9b8a0f1fa33b0d7a340c15fd1d1","src/tests.rs":"fb14f80509a991af90a0aef85e55429ad79d7e499112ff06f8ac54e5a6a7acfa","src/tests/all.rs":"e99a865cd4271a524c2fe95503e96d851b35990570aed6fb2e9dac7a14da31b6","src/tests/bits.rs":"3840c34b2ea5d1802404b9ce5bcc1d3fa6ccd8dfba2e29e6d07c605f817d90df","src/tests/complement.rs":"d0e6d4c3daf49e0a7438c9f1c1ac91fad1b37f258c03593f6cd6a695ee626f5e","src/tests/contains.rs":"58bb3cb8c86550e775d11134da1d4aca85c83f943ea454e3a5f222772c674a24","src/tests/difference.rs":"d0d2b96bb52658b8ac019210da74ca75a53e76622f668855142ea6e97c28cb0e","src/tests/empty.rs":"817d6e93ced7cb7576ff0e334aa1a44703f3f96871ff2c6bdcb8f207e6551f67","src/tests/eq.rs":"b816767680a029e9c163e37af074dd4e604c4a3e4936f829f0ca3774fd5f0e37","src/tests/extend.rs":"5fabb9fd0254c64da019149c24063fceff72da3eb4ad73b57c1cc4c04b008364","src/tests/flags.rs":"2f48d3a25db1cf66fe98c9959abc70875deb9f7b38b2c278dc70c46e0d4ec277","src/tests/fmt.rs":"a2d4148491f3202f030f63633eee941b741e3be29a68cf376f008dbe5cb11e5c","src/tests/from_bits.rs":"d94c65b88bf89961d0cfc1b3152a7f1acc285bae160a1628438effda11b8e2c1","src/tests/from_bits_retain.rs":"980591dfaf91e940f42d9a1ce890f237514dd59d458fc264abcf9ceabbc40677","src/tests/from_bits_truncate.rs":"d3406b5e107ebb6449b98a59eee6cc5d84f947d4aaee1ee7e80dc7202de179f0","src/tests/from_name.rs":"f4a055d1f3c86decef70ef8f3020cef5c4e229718c20b3d59d5a3abc3a8b1298","src/tests/insert.rs":"3fab5da800a6fc0654dfb5f859f95da65a507eb9fda8695083c2712266dff0b9","src/tests/intersection.rs":"baf1454c9e4eba552264870a556ee0032d9f2bb8cac361833d571235e0b52221","src/tests/intersects.rs":"c55e36179fd8bc636f04ea9bbce346dcaafe57915d13f1df28c5b83117dbd08e","src/tests/is_all.rs":"b2f11faa7c954bd85c8fb39999e0c37d983cf7895152bc13c7ddde106aa33b6d","src/tests/is_empty.rs":"11f21323cdca7ff92dd89e09de667dba69e8dce88e2d3e27ea68ace91d15d070","src/tests/iter.rs":"4ba121932b527e787b82745405c7c65c1084c242e2dda3290d475ec160d265e4","src/tests/parser.rs":"fa2fb8dedcf16601af609a5e21d9c5840c7f96a1e3a587f7f2ea3dc8387f7628","src/tests/remove.rs":"6e75f8508d2dc1a2cba89ef691f4387a665a4fd13853bb1dd0fd80c783b89947","src/tests/symmetric_difference.rs":"0a89f084f9de1dd5b1932fe72c3b10a3c93cbaa16832b3a31b6a85e3bbd3ba6e","src/tests/truncate.rs":"683430af4a0e47ec73c737a6908fac5d851bed7c41d47c73a642e96d966aa5ae","src/tests/union.rs":"88f398ee4600bb1e59bf6d02d1f6ff33f5f853eab5a6c700bd8a683c6ee4651a","src/tests/unknown.rs":"fa9e8ee461f176c0d892cde487fef0fe66df2aa5906aaef21b093102e590f5f5","src/traits.rs":"370c414a6b621ffe6e018861b481671dffa2689de39759922d03cdd12e5b612b"},"package":"1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be"}
\ No newline at end of file
diff --git a/crates/bitflags/Android.bp b/crates/bitflags/Android.bp
index 9689f8c..2f88ae0 100644
--- a/crates/bitflags/Android.bp
+++ b/crates/bitflags/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "bitflags",
cargo_env_compat: true,
- cargo_pkg_version: "2.6.0",
+ cargo_pkg_version: "2.7.0",
crate_root: "src/lib.rs",
edition: "2021",
apex_available: [
diff --git a/crates/bitflags/CHANGELOG.md b/crates/bitflags/CHANGELOG.md
index f17d469..fc6134a 100644
--- a/crates/bitflags/CHANGELOG.md
+++ b/crates/bitflags/CHANGELOG.md
@@ -1,3 +1,20 @@
+# 2.7.0
+
+## What's Changed
+* Fix `clippy::doc_lazy_continuation` lints by @waywardmonkeys in https://github.com/bitflags/bitflags/pull/414
+* Run clippy on extra features in CI. by @waywardmonkeys in https://github.com/bitflags/bitflags/pull/415
+* Fix CI: trybuild refresh, allow some clippy restrictions. by @waywardmonkeys in https://github.com/bitflags/bitflags/pull/417
+* Update zerocopy version in example by @KodrAus in https://github.com/bitflags/bitflags/pull/422
+* Add method to check if unknown bits are set by @wysiwys in https://github.com/bitflags/bitflags/pull/426
+* Update error messages by @KodrAus in https://github.com/bitflags/bitflags/pull/427
+* Add `truncate(&mut self)` method to unset unknown bits by @wysiwys in https://github.com/bitflags/bitflags/pull/428
+* Update error messages by @KodrAus in https://github.com/bitflags/bitflags/pull/429
+
+## New Contributors
+* @wysiwys made their first contribution in https://github.com/bitflags/bitflags/pull/426
+
+**Full Changelog**: https://github.com/bitflags/bitflags/compare/2.6.0...2.7.0
+
# 2.6.0
## What's Changed
diff --git a/crates/bitflags/Cargo.lock b/crates/bitflags/Cargo.lock
index 5f98ce0..10910a3 100644
--- a/crates/bitflags/Cargo.lock
+++ b/crates/bitflags/Cargo.lock
@@ -4,16 +4,16 @@
[[package]]
name = "arbitrary"
-version = "1.3.2"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
+checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
dependencies = [
"derive_arbitrary",
]
[[package]]
name = "bitflags"
-version = "2.6.0"
+version = "2.7.0"
dependencies = [
"arbitrary",
"bytemuck",
@@ -30,18 +30,18 @@
[[package]]
name = "bytemuck"
-version = "1.16.1"
+version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
+checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
-version = "1.7.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b"
+checksum = "882ce8da04f2b62f52b2485ed297687a43a8438374e7c2261a80601ecb4bac04"
dependencies = [
"proc-macro2",
"quote",
@@ -49,22 +49,16 @@
]
[[package]]
-name = "byteorder"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
-
-[[package]]
name = "compiler_builtins"
-version = "0.1.112"
+version = "0.1.142"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b15acab2bb4fe4dad1f1e31f3d9e714f50ef561a0f87dd8a9da004f14d455e1a"
+checksum = "78013b42e2946a76d348a858fa5a06ca7d6b5cccdfccd660ea7a0aa4a44d40ca"
[[package]]
name = "derive_arbitrary"
-version = "1.3.2"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
+checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
dependencies = [
"proc-macro2",
"quote",
@@ -79,21 +73,21 @@
[[package]]
name = "glob"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "hashbrown"
-version = "0.14.5"
+version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "indexmap"
-version = "2.2.6"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
+checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [
"equivalent",
"hashbrown",
@@ -101,9 +95,9 @@
[[package]]
name = "itoa"
-version = "1.0.11"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]]
name = "memchr"
@@ -113,33 +107,33 @@
[[package]]
name = "proc-macro2"
-version = "1.0.86"
+version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.36"
+version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rustc-std-workspace-core"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c"
+checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955"
[[package]]
name = "rustversion"
-version = "1.0.17"
+version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
+checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
[[package]]
name = "ryu"
@@ -149,18 +143,18 @@
[[package]]
name = "serde"
-version = "1.0.203"
+version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
+checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.203"
+version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
+checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"proc-macro2",
"quote",
@@ -169,38 +163,39 @@
[[package]]
name = "serde_json"
-version = "1.0.117"
+version = "1.0.135"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
+checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
dependencies = [
"itoa",
+ "memchr",
"ryu",
"serde",
]
[[package]]
name = "serde_spanned"
-version = "0.6.6"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
+checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [
"serde",
]
[[package]]
name = "serde_test"
-version = "1.0.176"
+version = "1.0.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a2f49ace1498612d14f7e0b8245519584db8299541dfe31a06374a828d620ab"
+checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed"
dependencies = [
"serde",
]
[[package]]
name = "syn"
-version = "2.0.68"
+version = "2.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
+checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
dependencies = [
"proc-macro2",
"quote",
@@ -208,6 +203,12 @@
]
[[package]]
+name = "target-triple"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078"
+
+[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -218,9 +219,9 @@
[[package]]
name = "toml"
-version = "0.8.14"
+version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
+checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
dependencies = [
"serde",
"serde_spanned",
@@ -230,18 +231,18 @@
[[package]]
name = "toml_datetime"
-version = "0.6.6"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
-version = "0.22.14"
+version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
+checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap",
"serde",
@@ -252,47 +253,48 @@
[[package]]
name = "trybuild"
-version = "1.0.96"
+version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33a5f13f11071020bb12de7a16b925d2d58636175c20c11dc5f96cb64bb6c9b3"
+checksum = "8dcd332a5496c026f1e14b7f3d2b7bd98e509660c04239c58b0ba38a12daded4"
dependencies = [
"glob",
"serde",
"serde_derive",
"serde_json",
+ "target-triple",
"termcolor",
"toml",
]
[[package]]
name = "unicode-ident"
-version = "1.0.12"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "winapi-util"
-version = "0.1.8"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
+checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys",
]
[[package]]
name = "windows-sys"
-version = "0.52.0"
+version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
@@ -306,76 +308,75 @@
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.52.5"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
-version = "0.6.13"
+version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
+checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980"
dependencies = [
"memchr",
]
[[package]]
name = "zerocopy"
-version = "0.7.34"
+version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
+checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468"
dependencies = [
- "byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.7.34"
+version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
+checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1"
dependencies = [
"proc-macro2",
"quote",
diff --git a/crates/bitflags/Cargo.toml b/crates/bitflags/Cargo.toml
index 54c4b82..1e9a2ff 100644
--- a/crates/bitflags/Cargo.toml
+++ b/crates/bitflags/Cargo.toml
@@ -13,12 +13,18 @@
edition = "2021"
rust-version = "1.56.0"
name = "bitflags"
-version = "2.6.0"
+version = "2.7.0"
authors = ["The Rust Project Developers"]
+build = false
exclude = [
"/tests",
"/.github",
]
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = """
A macro to generate structures which behave like bitflags.
"""
@@ -38,6 +44,34 @@
[package.metadata.docs.rs]
features = ["example_generated"]
+[lib]
+name = "bitflags"
+path = "src/lib.rs"
+
+[[example]]
+name = "custom_bits_type"
+path = "examples/custom_bits_type.rs"
+
+[[example]]
+name = "custom_derive"
+path = "examples/custom_derive.rs"
+
+[[example]]
+name = "fmt"
+path = "examples/fmt.rs"
+
+[[example]]
+name = "macro_free"
+path = "examples/macro_free.rs"
+
+[[example]]
+name = "serde"
+path = "examples/serde.rs"
+
+[[bench]]
+name = "parse"
+path = "benches/parse.rs"
+
[dependencies.arbitrary]
version = "1.0"
optional = true
@@ -84,7 +118,7 @@
version = "1.0.18"
[dev-dependencies.zerocopy]
-version = "0.7"
+version = "0.8"
features = ["derive"]
[features]
diff --git a/crates/bitflags/METADATA b/crates/bitflags/METADATA
index c33887c..a0db309 100644
--- a/crates/bitflags/METADATA
+++ b/crates/bitflags/METADATA
@@ -1,17 +1,17 @@
name: "bitflags"
description: "A macro to generate structures which behave like bitflags."
third_party {
- version: "2.6.0"
+ version: "2.7.0"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 5
- day: 31
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/bitflags"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/bitflags/bitflags-2.6.0.crate"
- version: "2.6.0"
+ value: "https://static.crates.io/crates/bitflags/bitflags-2.7.0.crate"
+ version: "2.7.0"
}
}
diff --git a/crates/bitflags/README.md b/crates/bitflags/README.md
index f2ad555..19f9268 100644
--- a/crates/bitflags/README.md
+++ b/crates/bitflags/README.md
@@ -28,7 +28,7 @@
```toml
[dependencies]
-bitflags = "2.6.0"
+bitflags = "2.7.0"
```
and this to your source code:
diff --git a/crates/bitflags/examples/custom_derive.rs b/crates/bitflags/examples/custom_derive.rs
index 4239ee4..ba26723 100644
--- a/crates/bitflags/examples/custom_derive.rs
+++ b/crates/bitflags/examples/custom_derive.rs
@@ -6,7 +6,7 @@
// Define a flags type outside of the `bitflags` macro as a newtype
// It can accept custom derives for libraries `bitflags` doesn't support natively
-#[derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)]
+#[derive(zerocopy::IntoBytes, zerocopy::FromBytes, zerocopy::KnownLayout, zerocopy::Immutable)]
#[repr(transparent)]
pub struct ManualFlags(u32);
diff --git a/crates/bitflags/src/external/arbitrary.rs b/crates/bitflags/src/external/arbitrary.rs
index ea76f0a..edde9b5 100644
--- a/crates/bitflags/src/external/arbitrary.rs
+++ b/crates/bitflags/src/external/arbitrary.rs
@@ -9,7 +9,7 @@
where
B::Bits: arbitrary::Arbitrary<'a>,
{
- B::from_bits(u.arbitrary()?).ok_or_else(|| arbitrary::Error::IncorrectFormat)
+ B::from_bits(u.arbitrary()?).ok_or(arbitrary::Error::IncorrectFormat)
}
#[cfg(test)]
diff --git a/crates/bitflags/src/lib.rs b/crates/bitflags/src/lib.rs
index a9a6aa4..97e808f 100644
--- a/crates/bitflags/src/lib.rs
+++ b/crates/bitflags/src/lib.rs
@@ -17,7 +17,7 @@
```toml
[dependencies.bitflags]
-version = "2.6.0"
+version = "2.7.0"
```
## Generating flags types
@@ -71,10 +71,10 @@
libraries are currently supported:
- `serde`: Support `#[derive(Serialize, Deserialize)]`, using text for human-readable formats,
-and a raw number for binary formats.
+ and a raw number for binary formats.
- `arbitrary`: Support `#[derive(Arbitrary)]`, only generating flags values with known bits.
- `bytemuck`: Support `#[derive(Pod, Zeroable)]`, for casting between flags values and their
-underlying bits values.
+ underlying bits values.
You can also define your own flags type outside of the [`bitflags`] macro and then use it to generate methods.
This can be useful if you need a custom `#[derive]` attribute for a library that `bitflags` doesn't
diff --git a/crates/bitflags/src/tests.rs b/crates/bitflags/src/tests.rs
index ed52ad4..28ed0a6 100644
--- a/crates/bitflags/src/tests.rs
+++ b/crates/bitflags/src/tests.rs
@@ -21,7 +21,9 @@
mod parser;
mod remove;
mod symmetric_difference;
+mod truncate;
mod union;
+mod unknown;
bitflags! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
diff --git a/crates/bitflags/src/tests/truncate.rs b/crates/bitflags/src/tests/truncate.rs
new file mode 100644
index 0000000..e38df48
--- /dev/null
+++ b/crates/bitflags/src/tests/truncate.rs
@@ -0,0 +1,29 @@
+use super::*;
+
+use crate::Flags;
+
+#[test]
+fn cases() {
+ case(
+ TestFlags::ABC | TestFlags::from_bits_retain(1 << 3),
+ TestFlags::ABC,
+ );
+
+ case(TestZero::empty(), TestZero::empty());
+
+ case(TestZero::all(), TestZero::all());
+
+ case(
+ TestFlags::from_bits_retain(1 << 3) | TestFlags::all(),
+ TestFlags::all(),
+ );
+}
+
+#[track_caller]
+fn case<T: Flags + std::fmt::Debug>(mut before: T, after: T)
+where
+ T: std::fmt::Debug + PartialEq + Copy,
+{
+ before.truncate();
+ assert_eq!(before, after, "{:?}.truncate()", before);
+}
diff --git a/crates/bitflags/src/tests/unknown.rs b/crates/bitflags/src/tests/unknown.rs
new file mode 100644
index 0000000..020f7e9
--- /dev/null
+++ b/crates/bitflags/src/tests/unknown.rs
@@ -0,0 +1,40 @@
+use super::*;
+
+use crate::Flags;
+
+#[test]
+fn cases() {
+ case(false, TestFlags::empty(), TestFlags::contains_unknown_bits);
+ case(false, TestFlags::A, TestFlags::contains_unknown_bits);
+
+ case(
+ true,
+ TestFlags::ABC | TestFlags::from_bits_retain(1 << 3),
+ TestFlags::contains_unknown_bits,
+ );
+
+ case(
+ true,
+ TestFlags::empty() | TestFlags::from_bits_retain(1 << 3),
+ TestFlags::contains_unknown_bits,
+ );
+
+ case(false, TestFlags::all(), TestFlags::contains_unknown_bits);
+
+ case(false, TestZero::empty(), TestZero::contains_unknown_bits);
+}
+#[track_caller]
+fn case<T: Flags + std::fmt::Debug>(expected: bool, value: T, inherent: impl FnOnce(&T) -> bool) {
+ assert_eq!(
+ expected,
+ inherent(&value),
+ "{:?}.contains_unknown_bits()",
+ value
+ );
+ assert_eq!(
+ expected,
+ Flags::contains_unknown_bits(&value),
+ "Flags::contains_unknown_bits({:?})",
+ value
+ );
+}
diff --git a/crates/bitflags/src/traits.rs b/crates/bitflags/src/traits.rs
index 3905d7d..d351bfc 100644
--- a/crates/bitflags/src/traits.rs
+++ b/crates/bitflags/src/traits.rs
@@ -152,6 +152,11 @@
Self::from_bits_retain(truncated)
}
+ /// This method will return `true` if any unknown bits are set.
+ fn contains_unknown_bits(&self) -> bool {
+ Self::all().bits() & self.bits() != self.bits()
+ }
+
/// Get the underlying bits value.
///
/// The returned value is exactly the bits set in this flags value.
@@ -241,6 +246,14 @@
self.bits() & other.bits() == other.bits()
}
+ /// Remove any unknown bits from the flags.
+ fn truncate(&mut self)
+ where
+ Self: Sized,
+ {
+ *self = Self::from_bits_truncate(self.bits());
+ }
+
/// The bitwise or (`|`) of the bits in two flags values.
fn insert(&mut self, other: Self)
where
diff --git a/crates/bytemuck/.android-checksum.json b/crates/bytemuck/.android-checksum.json
index c366fab..e656abb 100644
--- a/crates/bytemuck/.android-checksum.json
+++ b/crates/bytemuck/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"611988967ee97aea7f05e00cfa027906b204dfc1dc47696e2c502e0524c3fa7a","Android.bp":"7954e136a195b0d26a4a0730f26a18f010fde3cc928b6f83522cc77b62fd6d26","Cargo.toml":"5fed6f33707c14e08f181a0f19bc5c9a7b4307d8cf5373b83a0eb91e73241930","LICENSE":"26c86e25199583069f0f8205e7a76be5bc10af20d9204df80f281a2ea9520941","LICENSE-APACHE":"26c86e25199583069f0f8205e7a76be5bc10af20d9204df80f281a2ea9520941","LICENSE-MIT":"cec4013700872627ee18d2128d3bbde3e1bf1912a61eec493299dc0f434300fb","LICENSE-ZLIB":"a5748e7b6f484bb179d81e382c7cf9526f2da5dc1b027844ae85ed0b739cb56d","METADATA":"9c740a8e8a247f3f164cf039d36add1e74f8b7bfa24b3245f128cfb1fa42e944","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"f6af7c3c0ef64c3625910cbf81cf69fe64d0ca6de5103379ae05cccc082c6a46","TEST_MAPPING":"56f237fe59538452b8639ea7252252654ac69662663eb2ea34ad388b1dae7572","cargo_embargo.json":"e0c03e048791d1e8f84c21f1e4d0b0db189a2ac3ca1d3feefdbc61d164342272","changelog.md":"68997787e8d711fa2e509feb230e7dd00a1556d9e45c1af43478d14585a7fea8","rustfmt.toml":"4dc084ed1f8eee76d5623a48573701dbb3eed85d0c858e50ad79c262598cc1c4","src/allocation.rs":"d0b8464cba876373fd2cd892f98ab8d7a8738bc850183ee084fb811c63c39912","src/anybitpattern.rs":"ae2f6c7567ac0050fd81bbe64c4552386f82c410d8c8f95844f348a523afa099","src/checked.rs":"be6b0edd1e7e65b06f109994e074f117b14378d0422d2da554745681566beeab","src/contiguous.rs":"5f226111b202ae4af33a67aebd72d5d4783b124f5aa2871aee7f5161e1f6d7fb","src/internal.rs":"77ac39d72f4c0c2baa2a9132574470dc603bce34c4f2a53e773c68538f83ac05","src/lib.rs":"3e83eb476477ad4f256e5c6258b86d9cac394dde53bf59866866d00d5529b82f","src/must.rs":"3e44ff35e8691b18f80ee897b2c521cac3cca4b13b1cfb77dbefc37ec4497a24","src/no_uninit.rs":"06a546319aac8a0cee275815860594121b16f5f740ee14aa62d28529242a9bb1","src/offset_of.rs":"d0726ced360c280d4c9f6d4dc709db482049c71434baa4810ea8782510b05989","src/pod.rs":"8f8d08e26cb5b784c682f50c9cc7432f1a592bb1d4ae72283ecbd13771736b51","src/pod_in_option.rs":"e88a449242133014c7490ae6c0ee4c164f3f41de80f329ce823299ce0fbc0692","src/transparent.rs":"43d6b547d72aa58fb31482fa61dcf2e5beb7075e2419805ae20c16915aa15083","src/zeroable.rs":"551b8f8fdec212afef7aa1d608542a78f994e404a0928b7baed251ec23391ae3","src/zeroable_in_option.rs":"e7e1842d2ae5af18cc040b2de9b4300b0ad8a29ffec2a0e1eea554f742765740","tests/array_tests.rs":"63a1f7bf11d09234d456f1eda4f7c59f7af313ee7f692f085fec6c7a303ab0a0","tests/cast_slice_tests.rs":"0fccf1f772c3eed58e24dd3cd0ef7e6c3f580fbc21867a849a35094a906a16b5","tests/checked_tests.rs":"2bee46585c6b6608df216381b1326c2fd56e05c8d7d121db4d37368eeff5fc7e","tests/derive.rs":"4d90facd45007555640269a46a0ef1c904c8665ee1ace879fa0c722977dc0acd","tests/doc_tests.rs":"ebc71de72bfe4499e0b512c94df4c06daa2cb09b6a519690e1f5d9d9e5ebc4dc","tests/offset_of_tests.rs":"fab12e44f1a5f7b86047b5bfa922d800081a2a3a27d58a9f72e374a73aec7f4f","tests/std_tests.rs":"45484e668354e80608df356860805ece04402ec4698760600d87dfc628089f3e","tests/transparent.rs":"66bb171f783a5ede3955ee63562352d538ca11eb16a9bfe72cc38b0f72e5a230","tests/wrapper_forgets.rs":"436c24e0834ff341db64b4b52bceb5c18c83415d01f830c2ec0fcad7266d4ba5"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"f0c247a14128bd7289a47cbbdb5d1df42f665bc16ea40c12fc5a1085774d6097","Android.bp":"9f13e6a1a13a7085aada8ac14c907fca0dd5e7f9f53dc41fd00cb75502d1f3e0","Cargo.toml":"0c59d16070f73859f051853924caf7fbeb7d052b55f9f4fd6c7e8960ec0c0e89","LICENSE":"26c86e25199583069f0f8205e7a76be5bc10af20d9204df80f281a2ea9520941","LICENSE-APACHE":"26c86e25199583069f0f8205e7a76be5bc10af20d9204df80f281a2ea9520941","LICENSE-MIT":"cec4013700872627ee18d2128d3bbde3e1bf1912a61eec493299dc0f434300fb","LICENSE-ZLIB":"a5748e7b6f484bb179d81e382c7cf9526f2da5dc1b027844ae85ed0b739cb56d","METADATA":"3f628b4d272e28eaed30808a93030c4c88c268a7d362c2610d30ca5e527361df","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"f6af7c3c0ef64c3625910cbf81cf69fe64d0ca6de5103379ae05cccc082c6a46","TEST_MAPPING":"56f237fe59538452b8639ea7252252654ac69662663eb2ea34ad388b1dae7572","cargo_embargo.json":"e0c03e048791d1e8f84c21f1e4d0b0db189a2ac3ca1d3feefdbc61d164342272","changelog.md":"2e0e62c563845a666a56ffe666acc2c99464207fb90087b4b8b3335e0d71a510","rustfmt.toml":"4dc084ed1f8eee76d5623a48573701dbb3eed85d0c858e50ad79c262598cc1c4","src/allocation.rs":"d0b8464cba876373fd2cd892f98ab8d7a8738bc850183ee084fb811c63c39912","src/anybitpattern.rs":"ae2f6c7567ac0050fd81bbe64c4552386f82c410d8c8f95844f348a523afa099","src/checked.rs":"8cdfa353780fcac3d085d1f00d170f7be08214fe899ce7dc921de221159f6e5c","src/contiguous.rs":"5f226111b202ae4af33a67aebd72d5d4783b124f5aa2871aee7f5161e1f6d7fb","src/internal.rs":"77ac39d72f4c0c2baa2a9132574470dc603bce34c4f2a53e773c68538f83ac05","src/lib.rs":"d358cc206da405c292132e28a485f00e7736051fd9e7ae56c7b1b2984b314ce9","src/must.rs":"ebe31709688108949d832d516f6115a76915da723c27b015f4f5c04f0f788027","src/no_uninit.rs":"06a546319aac8a0cee275815860594121b16f5f740ee14aa62d28529242a9bb1","src/offset_of.rs":"d0726ced360c280d4c9f6d4dc709db482049c71434baa4810ea8782510b05989","src/pod.rs":"7b1b485d33ed7dfeb4be4887f7c8b8d5304588b41cddd458acb532a51823bcbd","src/pod_in_option.rs":"e88a449242133014c7490ae6c0ee4c164f3f41de80f329ce823299ce0fbc0692","src/transparent.rs":"43d6b547d72aa58fb31482fa61dcf2e5beb7075e2419805ae20c16915aa15083","src/zeroable.rs":"f6da412d43d593906000113da6534b6964f3a18f0db14c0877f371b2c1e8e020","src/zeroable_in_option.rs":"e7e1842d2ae5af18cc040b2de9b4300b0ad8a29ffec2a0e1eea554f742765740","tests/array_tests.rs":"63a1f7bf11d09234d456f1eda4f7c59f7af313ee7f692f085fec6c7a303ab0a0","tests/cast_slice_tests.rs":"0fccf1f772c3eed58e24dd3cd0ef7e6c3f580fbc21867a849a35094a906a16b5","tests/checked_tests.rs":"2bee46585c6b6608df216381b1326c2fd56e05c8d7d121db4d37368eeff5fc7e","tests/derive.rs":"4d90facd45007555640269a46a0ef1c904c8665ee1ace879fa0c722977dc0acd","tests/doc_tests.rs":"ebc71de72bfe4499e0b512c94df4c06daa2cb09b6a519690e1f5d9d9e5ebc4dc","tests/offset_of_tests.rs":"fab12e44f1a5f7b86047b5bfa922d800081a2a3a27d58a9f72e374a73aec7f4f","tests/std_tests.rs":"45484e668354e80608df356860805ece04402ec4698760600d87dfc628089f3e","tests/transparent.rs":"66bb171f783a5ede3955ee63562352d538ca11eb16a9bfe72cc38b0f72e5a230","tests/wrapper_forgets.rs":"436c24e0834ff341db64b4b52bceb5c18c83415d01f830c2ec0fcad7266d4ba5"}}
\ No newline at end of file
diff --git a/crates/bytemuck/.cargo-checksum.json b/crates/bytemuck/.cargo-checksum.json
index e94d33d..2d9934f 100644
--- a/crates/bytemuck/.cargo-checksum.json
+++ b/crates/bytemuck/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"3649299f411a320ac0451f7c2f169ccd0b9246b93a95e3fb319a68dac04064fb","LICENSE-APACHE":"870e20c217d15bcfcbe53d7c5867cd8fac44a4ca0b41fc1eb843557e16063eba","LICENSE-MIT":"0b2d108c9c686a74ac312990ee8377902756a2a081a7af3b0f9d68abf0a8f1a1","LICENSE-ZLIB":"682b4c81b85e83ce6cc6e1ace38fdd97aeb4de0e972bd2b44aa0916c54af8c96","README.md":"167493de1f1ad16d13c778494ae344cd71306622c89d19002eaf7f4185c1f728","changelog.md":"8c79c066f7cccfac1e02badcbc8193de5511745ece3eae7a788dffbbfa8df239","rustfmt.toml":"f4c215534437936f924c937dbb1677f614761589300d6b389f3b518b3eb551b8","src/allocation.rs":"be0c1075015d32698722183523dae7d9cd679f93f6692e733dd6a361214404c9","src/anybitpattern.rs":"172bcc22ba7b38a9a36e34d0aa5efc8716bba77569a3c142f16f8103046f1d45","src/checked.rs":"f60c88558dbf7e1d7d2be43dce7efb100c8710cf57455d3cf586ddad4f274b14","src/contiguous.rs":"bb340c0f20a06aa725bb625edcb493146ba64980fd1fd9e450654aa37384c564","src/internal.rs":"2b5b4fdc1a5d14462dd604ca1f4f23116f40639d7d8b4c1a7189ce276edd8272","src/lib.rs":"ae83f2eb38d059356410b004024b4be500f4beebbe4d83face255f3912c47507","src/must.rs":"e14643ef6a89d2caf87b9907a5cc5624962074963ec1a046ed7ee4b37cd7eb83","src/no_uninit.rs":"4ab2f5ed29bff0b33630661154eb548f3e55581bfcf576a90397b7f8d5323201","src/offset_of.rs":"2afd190ef0462b30ade786fe813a91e7bf41cc2fa99a1d79002cbafab5964f37","src/pod.rs":"b149ec10657dc45039b0be57ef89a4be638ab54d7d15bb7a5094c48f5b067ee5","src/pod_in_option.rs":"73bbe1d69f32d909695ce26d131aa2d81eaa31e2b4532256ebfe1a6ba68675c1","src/transparent.rs":"5e555d6d83f5fe215ce2dbc949e87977aa92ab8d6f7a9be8479f63fdeda2359f","src/zeroable.rs":"fc38a6e1c6ff8f36407279752ee3858fedcb9b94a334273d74da0851dbbf89cf","src/zeroable_in_option.rs":"f74799ac3eee50116ec63a0ae4d3e351e0ab7ac807d01b4b59027bf6a68d6de6","tests/array_tests.rs":"98ca7a0dcd93e65f70d4db19643e707cafae5a249561ab151998cedb89b2e036","tests/cast_slice_tests.rs":"1869416e833757f603765afbf48152a6d32a100316529eb494b48fca6c5a8899","tests/checked_tests.rs":"27965acf20e46482b09ee56aaa2536868821be651a3b95052f40e554ecde9917","tests/derive.rs":"93b5ab70ecdd726811af9dee1702e23e964b8ceac59f727889f6a2678ad90d65","tests/doc_tests.rs":"f20708319fde62d8957909d51ee976fce394ad0891ebc4bbcf336ab026a34092","tests/offset_of_tests.rs":"fb5f91e17f984050969f8b06f1de58b5c1e80802c5deb992d3188f5ec274690f","tests/std_tests.rs":"967d4fb4cae24a374633c9b68f1ff65f86ba4c8a0e980adfe69dcaf60a9049c2","tests/transparent.rs":"ecef6e0987e28121b480942e58ce4534f13fe35667bde7f5c6e04e590b02f6a3","tests/wrapper_forgets.rs":"c6330546f6aa696245625056e7323b3916e3fb1a9fbecefe9c9e62d3726812d9"},"package":"8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a"}
\ No newline at end of file
+{"files":{"Cargo.toml":"97a0b8234556120873b15b5bf6ac70930f5fe38900bbcc70ba6283467a52b1f8","LICENSE-APACHE":"870e20c217d15bcfcbe53d7c5867cd8fac44a4ca0b41fc1eb843557e16063eba","LICENSE-MIT":"0b2d108c9c686a74ac312990ee8377902756a2a081a7af3b0f9d68abf0a8f1a1","LICENSE-ZLIB":"682b4c81b85e83ce6cc6e1ace38fdd97aeb4de0e972bd2b44aa0916c54af8c96","README.md":"167493de1f1ad16d13c778494ae344cd71306622c89d19002eaf7f4185c1f728","changelog.md":"bc6a75f248b44c5f9e97f99ed133b8bc6eeeb6aa1f1436442d1f6a6a3b53d6b5","rustfmt.toml":"f4c215534437936f924c937dbb1677f614761589300d6b389f3b518b3eb551b8","src/allocation.rs":"be0c1075015d32698722183523dae7d9cd679f93f6692e733dd6a361214404c9","src/anybitpattern.rs":"172bcc22ba7b38a9a36e34d0aa5efc8716bba77569a3c142f16f8103046f1d45","src/checked.rs":"35f69278bf0106ce2855bff48ae3aeb125a54c3ee4afb123cbfe135d518e68c0","src/contiguous.rs":"bb340c0f20a06aa725bb625edcb493146ba64980fd1fd9e450654aa37384c564","src/internal.rs":"2b5b4fdc1a5d14462dd604ca1f4f23116f40639d7d8b4c1a7189ce276edd8272","src/lib.rs":"752aa0122fa8e3d80dfc48d0bf694aebbbccf7a3686ca2376aca7bb60ed627c3","src/must.rs":"fed78b2a4dac5ef6758bab53a4f3bcabd8da071854bcc07dc70a255b327ec64c","src/no_uninit.rs":"4ab2f5ed29bff0b33630661154eb548f3e55581bfcf576a90397b7f8d5323201","src/offset_of.rs":"2afd190ef0462b30ade786fe813a91e7bf41cc2fa99a1d79002cbafab5964f37","src/pod.rs":"b010341e374a7c26f84286178c435f6df2e9d80f47306cb1dc29fdb0bc4d8e0f","src/pod_in_option.rs":"73bbe1d69f32d909695ce26d131aa2d81eaa31e2b4532256ebfe1a6ba68675c1","src/transparent.rs":"5e555d6d83f5fe215ce2dbc949e87977aa92ab8d6f7a9be8479f63fdeda2359f","src/zeroable.rs":"f44c0dbfe27661e39c17379e9a3a6ad458b8ca004c1fbf3d352a18aed3f093b1","src/zeroable_in_option.rs":"f74799ac3eee50116ec63a0ae4d3e351e0ab7ac807d01b4b59027bf6a68d6de6","tests/array_tests.rs":"98ca7a0dcd93e65f70d4db19643e707cafae5a249561ab151998cedb89b2e036","tests/cast_slice_tests.rs":"1869416e833757f603765afbf48152a6d32a100316529eb494b48fca6c5a8899","tests/checked_tests.rs":"27965acf20e46482b09ee56aaa2536868821be651a3b95052f40e554ecde9917","tests/derive.rs":"93b5ab70ecdd726811af9dee1702e23e964b8ceac59f727889f6a2678ad90d65","tests/doc_tests.rs":"f20708319fde62d8957909d51ee976fce394ad0891ebc4bbcf336ab026a34092","tests/offset_of_tests.rs":"fb5f91e17f984050969f8b06f1de58b5c1e80802c5deb992d3188f5ec274690f","tests/std_tests.rs":"967d4fb4cae24a374633c9b68f1ff65f86ba4c8a0e980adfe69dcaf60a9049c2","tests/transparent.rs":"ecef6e0987e28121b480942e58ce4534f13fe35667bde7f5c6e04e590b02f6a3","tests/wrapper_forgets.rs":"c6330546f6aa696245625056e7323b3916e3fb1a9fbecefe9c9e62d3726812d9"},"package":"ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"}
\ No newline at end of file
diff --git a/crates/bytemuck/Android.bp b/crates/bytemuck/Android.bp
index 2f2a854..6f363de 100644
--- a/crates/bytemuck/Android.bp
+++ b/crates/bytemuck/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "array_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/array_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -41,7 +41,7 @@
host_supported: true,
crate_name: "cast_slice_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/cast_slice_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -64,7 +64,7 @@
host_supported: true,
crate_name: "checked_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/checked_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -87,7 +87,7 @@
host_supported: true,
crate_name: "doc_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/doc_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -110,7 +110,7 @@
host_supported: true,
crate_name: "offset_of_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/offset_of_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -133,7 +133,7 @@
host_supported: true,
crate_name: "std_tests",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/std_tests.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -156,7 +156,7 @@
host_supported: true,
crate_name: "transparent",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "tests/transparent.rs",
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -179,7 +179,7 @@
host_supported: true,
crate_name: "bytemuck",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "src/lib.rs",
edition: "2018",
features: [
@@ -202,7 +202,7 @@
name: "libbytemuck_nostd",
crate_name: "bytemuck",
cargo_env_compat: true,
- cargo_pkg_version: "1.20.0",
+ cargo_pkg_version: "1.21.0",
crate_root: "src/lib.rs",
edition: "2018",
features: [
diff --git a/crates/bytemuck/Cargo.toml b/crates/bytemuck/Cargo.toml
index 94bbf21..4f67c8d 100644
--- a/crates/bytemuck/Cargo.toml
+++ b/crates/bytemuck/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "bytemuck"
-version = "1.20.0"
+version = "1.21.0"
authors = ["Lokathor <[email protected]>"]
build = false
exclude = ["/pedantic.bat"]
@@ -97,25 +97,30 @@
aarch64_simd = []
align_offset = []
alloc_uninit = []
+avx512_simd = []
const_zeroed = []
derive = ["bytemuck_derive"]
extern_crate_alloc = []
extern_crate_std = ["extern_crate_alloc"]
latest_stable_rust = [
"aarch64_simd",
+ "avx512_simd",
"align_offset",
"alloc_uninit",
"const_zeroed",
"derive",
"min_const_generics",
"must_cast",
+ "must_cast_extra",
"track_caller",
+ "transparentwrapper_extra",
"wasm_simd",
"zeroable_atomics",
"zeroable_maybe_uninit",
]
min_const_generics = []
must_cast = []
+must_cast_extra = ["must_cast"]
nightly_docs = []
nightly_float = []
nightly_portable_simd = []
diff --git a/crates/bytemuck/METADATA b/crates/bytemuck/METADATA
index d2c3394..b5d7f4a 100644
--- a/crates/bytemuck/METADATA
+++ b/crates/bytemuck/METADATA
@@ -1,17 +1,17 @@
name: "bytemuck"
description: "A crate for mucking around with piles of bytes."
third_party {
- version: "1.20.0"
+ version: "1.21.0"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 12
- day: 19
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/bytemuck"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/bytemuck/bytemuck-1.20.0.crate"
- version: "1.20.0"
+ value: "https://static.crates.io/crates/bytemuck/bytemuck-1.21.0.crate"
+ version: "1.21.0"
}
}
diff --git a/crates/bytemuck/changelog.md b/crates/bytemuck/changelog.md
index 1e22f33..294647c 100644
--- a/crates/bytemuck/changelog.md
+++ b/crates/bytemuck/changelog.md
@@ -1,5 +1,14 @@
# `bytemuck` changelog
+## 1.21
+
+* Implement `Pod` and `Zeroable` for `core::arch::{x86, x86_64}::__m512`, `__m512d` and `__m512i` without nightly.
+ Requires Rust 1.72, and is gated through the `avx512_simd` cargo feature.
+* Allow the use of `must_cast_mut` and `must_cast_slice_mut` in const contexts.
+ Requires Rust 1.83, and is gated through the `must_cast_extra` cargo feature.
+* internal: introduced the `maybe_const_fn` macro that allows defining some function
+ to be const depending upon some `cfg` predicate.
+
## 1.20
* New functions to allocate zeroed `Arc` and `Rc`. Requires Rust 1.82
diff --git a/crates/bytemuck/src/checked.rs b/crates/bytemuck/src/checked.rs
index d0c92cb..c81b449 100644
--- a/crates/bytemuck/src/checked.rs
+++ b/crates/bytemuck/src/checked.rs
@@ -438,7 +438,7 @@
/// Reads the slice into a `T` value.
///
/// ## Panics
-/// * This is like `try_pod_read_unaligned` but will panic on failure.
+/// * This is like [`try_pod_read_unaligned`] but will panic on failure.
#[inline]
#[cfg_attr(feature = "track_caller", track_caller)]
pub fn pod_read_unaligned<T: CheckedBitPattern>(bytes: &[u8]) -> T {
diff --git a/crates/bytemuck/src/lib.rs b/crates/bytemuck/src/lib.rs
index 7679f74..f820762 100644
--- a/crates/bytemuck/src/lib.rs
+++ b/crates/bytemuck/src/lib.rs
@@ -1,5 +1,6 @@
#![no_std]
#![warn(missing_docs)]
+#![allow(unused_mut)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::result_unit_err)]
@@ -154,6 +155,25 @@
};
}
+/// A macro for conditionally const-ifying a function.
+/// #[allow(unused)] because currently it is only used with the `must_cast` feature.
+#[allow(unused)]
+macro_rules! maybe_const_fn {
+ (
+ #[cfg($cfg_predicate:meta)]
+ $(#[$attr:meta])*
+ $vis:vis $(unsafe $($unsafe:lifetime)?)? fn $name:ident $($rest:tt)*
+ ) => {
+ #[cfg($cfg_predicate)]
+ $(#[$attr])*
+ $vis const $(unsafe $($unsafe)?)? fn $name $($rest)*
+
+ #[cfg(not($cfg_predicate))]
+ $(#[$attr])*
+ $vis $(unsafe $($unsafe)?)? fn $name $($rest)*
+ };
+}
+
#[cfg(feature = "extern_crate_std")]
extern crate std;
diff --git a/crates/bytemuck/src/must.rs b/crates/bytemuck/src/must.rs
index 4753651..1bb5ccc 100644
--- a/crates/bytemuck/src/must.rs
+++ b/crates/bytemuck/src/must.rs
@@ -70,36 +70,39 @@
unsafe { &*(a as *const A as *const B) }
}
-/// Convert a `&mut A` into `&mut B` if infalliable, or fail to compile.
-///
-/// As [`must_cast_ref`], but `mut`.
-///
-/// ## Examples
-/// ```
-/// let mut i = 12_u16;
-/// // compiles:
-/// let bytes: &mut [u8; 2] = bytemuck::must_cast_mut(&mut i);
-/// ```
-/// ```compile_fail,E0080
-/// # let mut bytes: &mut [u8; 2] = &mut [1, 2];
-/// // fails to compile (alignment requirements increased):
-/// let i : &mut u16 = bytemuck::must_cast_mut(bytes);
-/// ```
-/// ```compile_fail,E0080
-/// # let mut i = 12_u16;
-/// // fails to compile (size mismatch):
-/// let bytes : &mut [u8; 3] = bytemuck::must_cast_mut(&mut i);
-/// ```
-#[inline]
-pub fn must_cast_mut<
- A: NoUninit + AnyBitPattern,
- B: NoUninit + AnyBitPattern,
->(
- a: &mut A,
-) -> &mut B {
- let _ = Cast::<A, B>::ASSERT_SIZE_EQUAL;
- let _ = Cast::<A, B>::ASSERT_ALIGN_GREATER_THAN_EQUAL;
- unsafe { &mut *(a as *mut A as *mut B) }
+maybe_const_fn! {
+ #[cfg(feature = "must_cast_extra")]
+ /// Convert a `&mut A` into `&mut B` if infalliable, or fail to compile.
+ ///
+ /// As [`must_cast_ref`], but `mut`.
+ ///
+ /// ## Examples
+ /// ```
+ /// let mut i = 12_u16;
+ /// // compiles:
+ /// let bytes: &mut [u8; 2] = bytemuck::must_cast_mut(&mut i);
+ /// ```
+ /// ```compile_fail,E0080
+ /// # let mut bytes: &mut [u8; 2] = &mut [1, 2];
+ /// // fails to compile (alignment requirements increased):
+ /// let i : &mut u16 = bytemuck::must_cast_mut(bytes);
+ /// ```
+ /// ```compile_fail,E0080
+ /// # let mut i = 12_u16;
+ /// // fails to compile (size mismatch):
+ /// let bytes : &mut [u8; 3] = bytemuck::must_cast_mut(&mut i);
+ /// ```
+ #[inline]
+ pub fn must_cast_mut<
+ A: NoUninit + AnyBitPattern,
+ B: NoUninit + AnyBitPattern,
+ >(
+ a: &mut A,
+ ) -> &mut B {
+ let _ = Cast::<A, B>::ASSERT_SIZE_EQUAL;
+ let _ = Cast::<A, B>::ASSERT_ALIGN_GREATER_THAN_EQUAL;
+ unsafe { &mut *(a as *mut A as *mut B) }
+ }
}
/// Convert `&[A]` into `&[B]` (possibly with a change in length) if
@@ -154,53 +157,56 @@
unsafe { core::slice::from_raw_parts(a.as_ptr() as *const B, new_len) }
}
-/// Convert `&mut [A]` into `&mut [B]` (possibly with a change in length) if
-/// infalliable, or fail to compile.
-///
-/// As [`must_cast_slice`], but `&mut`.
-///
-/// ## Examples
-/// ```
-/// let mut indicies = [1, 2, 3];
-/// let indicies: &mut [u16] = &mut indicies;
-/// // compiles:
-/// let bytes: &mut [u8] = bytemuck::must_cast_slice_mut(indicies);
-/// ```
-/// ```
-/// let zsts: &mut [()] = &mut [(), (), ()];
-/// // compiles:
-/// let bytes: &mut [u8] = bytemuck::must_cast_slice_mut(zsts);
-/// ```
-/// ```compile_fail,E0080
-/// # let mut bytes = [1, 0, 2, 0, 3, 0];
-/// # let bytes : &mut [u8] = &mut bytes[..];
-/// // fails to compile (bytes.len() might not be a multiple of 2):
-/// let byte_pairs : &mut [[u8; 2]] = bytemuck::must_cast_slice_mut(bytes);
-/// ```
-/// ```compile_fail,E0080
-/// # let mut byte_pairs = [[1, 0], [2, 0], [3, 0]];
-/// # let byte_pairs : &mut [[u8; 2]] = &mut byte_pairs[..];
-/// // fails to compile (alignment requirements increased):
-/// let indicies : &mut [u16] = bytemuck::must_cast_slice_mut(byte_pairs);
-/// ```
-/// ```compile_fail,E0080
-/// let bytes: &mut [u8] = &mut [];
-/// // fails to compile: (bytes.len() might not be 0)
-/// let zsts: &mut [()] = bytemuck::must_cast_slice_mut(bytes);
-/// ```
-#[inline]
-pub fn must_cast_slice_mut<
- A: NoUninit + AnyBitPattern,
- B: NoUninit + AnyBitPattern,
->(
- a: &mut [A],
-) -> &mut [B] {
- let _ = Cast::<A, B>::ASSERT_SIZE_MULTIPLE_OF_OR_INPUT_ZST;
- let _ = Cast::<A, B>::ASSERT_ALIGN_GREATER_THAN_EQUAL;
- let new_len = if size_of::<A>() == size_of::<B>() {
- a.len()
- } else {
- a.len() * (size_of::<A>() / size_of::<B>())
- };
- unsafe { core::slice::from_raw_parts_mut(a.as_mut_ptr() as *mut B, new_len) }
+maybe_const_fn! {
+ #[cfg(feature = "must_cast_extra")]
+ /// Convert `&mut [A]` into `&mut [B]` (possibly with a change in length) if
+ /// infalliable, or fail to compile.
+ ///
+ /// As [`must_cast_slice`], but `&mut`.
+ ///
+ /// ## Examples
+ /// ```
+ /// let mut indicies = [1, 2, 3];
+ /// let indicies: &mut [u16] = &mut indicies;
+ /// // compiles:
+ /// let bytes: &mut [u8] = bytemuck::must_cast_slice_mut(indicies);
+ /// ```
+ /// ```
+ /// let zsts: &mut [()] = &mut [(), (), ()];
+ /// // compiles:
+ /// let bytes: &mut [u8] = bytemuck::must_cast_slice_mut(zsts);
+ /// ```
+ /// ```compile_fail,E0080
+ /// # let mut bytes = [1, 0, 2, 0, 3, 0];
+ /// # let bytes : &mut [u8] = &mut bytes[..];
+ /// // fails to compile (bytes.len() might not be a multiple of 2):
+ /// let byte_pairs : &mut [[u8; 2]] = bytemuck::must_cast_slice_mut(bytes);
+ /// ```
+ /// ```compile_fail,E0080
+ /// # let mut byte_pairs = [[1, 0], [2, 0], [3, 0]];
+ /// # let byte_pairs : &mut [[u8; 2]] = &mut byte_pairs[..];
+ /// // fails to compile (alignment requirements increased):
+ /// let indicies : &mut [u16] = bytemuck::must_cast_slice_mut(byte_pairs);
+ /// ```
+ /// ```compile_fail,E0080
+ /// let bytes: &mut [u8] = &mut [];
+ /// // fails to compile: (bytes.len() might not be 0)
+ /// let zsts: &mut [()] = bytemuck::must_cast_slice_mut(bytes);
+ /// ```
+ #[inline]
+ pub fn must_cast_slice_mut<
+ A: NoUninit + AnyBitPattern,
+ B: NoUninit + AnyBitPattern,
+ >(
+ a: &mut [A],
+ ) -> &mut [B] {
+ let _ = Cast::<A, B>::ASSERT_SIZE_MULTIPLE_OF_OR_INPUT_ZST;
+ let _ = Cast::<A, B>::ASSERT_ALIGN_GREATER_THAN_EQUAL;
+ let new_len = if size_of::<A>() == size_of::<B>() {
+ a.len()
+ } else {
+ a.len() * (size_of::<A>() / size_of::<B>())
+ };
+ unsafe { core::slice::from_raw_parts_mut(a.as_mut_ptr() as *mut B, new_len) }
+ }
}
diff --git a/crates/bytemuck/src/pod.rs b/crates/bytemuck/src/pod.rs
index 7fdf5a6..7a60b08 100644
--- a/crates/bytemuck/src/pod.rs
+++ b/crates/bytemuck/src/pod.rs
@@ -153,17 +153,29 @@
}
impl_unsafe_marker_for_simd!(
+ #[cfg(all(target_arch = "x86", any(feature = "nightly_stdsimd", feature = "avx512_simd")))]
+ unsafe impl Pod for x86::{
+ __m512, __m512d, __m512i
+ }
+);
+
+impl_unsafe_marker_for_simd!(
+ #[cfg(all(target_arch = "x86_64", any(feature = "nightly_stdsimd", feature = "avx512_simd")))]
+ unsafe impl Pod for x86_64::{
+ __m512, __m512d, __m512i
+ }
+);
+
+impl_unsafe_marker_for_simd!(
#[cfg(all(target_arch = "x86", feature = "nightly_stdsimd"))]
unsafe impl Pod for x86::{
- __m128bh, __m256bh, __m512,
- __m512bh, __m512d, __m512i,
+ __m128bh, __m256bh, __m512bh
}
);
impl_unsafe_marker_for_simd!(
#[cfg(all(target_arch = "x86_64", feature = "nightly_stdsimd"))]
unsafe impl Pod for x86_64::{
- __m128bh, __m256bh, __m512,
- __m512bh, __m512d, __m512i,
+ __m128bh, __m256bh, __m512bh
}
);
diff --git a/crates/bytemuck/src/zeroable.rs b/crates/bytemuck/src/zeroable.rs
index 7eb476f..9d371a7 100644
--- a/crates/bytemuck/src/zeroable.rs
+++ b/crates/bytemuck/src/zeroable.rs
@@ -233,17 +233,29 @@
}
impl_unsafe_marker_for_simd!(
+ #[cfg(all(target_arch = "x86", any(feature = "nightly_stdsimd", feature = "avx512_simd")))]
+ unsafe impl Zeroable for x86::{
+ __m512, __m512d, __m512i
+ }
+);
+
+impl_unsafe_marker_for_simd!(
+ #[cfg(all(target_arch = "x86_64", any(feature = "nightly_stdsimd", feature = "avx512_simd")))]
+ unsafe impl Zeroable for x86_64::{
+ __m512, __m512d, __m512i
+ }
+);
+
+impl_unsafe_marker_for_simd!(
#[cfg(all(target_arch = "x86", feature = "nightly_stdsimd"))]
unsafe impl Zeroable for x86::{
- __m128bh, __m256bh, __m512,
- __m512bh, __m512d, __m512i,
+ __m128bh, __m256bh, __m512bh
}
);
impl_unsafe_marker_for_simd!(
#[cfg(all(target_arch = "x86_64", feature = "nightly_stdsimd"))]
unsafe impl Zeroable for x86_64::{
- __m128bh, __m256bh, __m512,
- __m512bh, __m512d, __m512i,
+ __m128bh, __m256bh, __m512bh
}
);
diff --git a/crates/glob/.android-checksum.json b/crates/glob/.android-checksum.json
index 362f196..0ec607e 100644
--- a/crates/glob/.android-checksum.json
+++ b/crates/glob/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"56c05b47b3bd5f8a50209ede542ce32a014163a618ea3027437e222a8e445921","Android.bp":"fdd29ea6f8b390632376a9af2d34cbbd67fa3886f5e85c7bdfa1ef0ae4d50bd0","Cargo.toml":"db5e77f01bed9cb4eb68ec0c7f6e43b37ca1ad893c55a77bdae40c47b3d77ae3","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"02117073c3090159bc4902a032a20695e8beaf2da035ef5db780adee89302252","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"aba9a7f946a48d0d78dd89df774679bd5547f43c88a7d6beb7d7f9d9a985b35d","TEST_MAPPING":"b980f27af06453e486aff3e93847a38c3886881743d109a9d083b8e6b60bee1d","cargo_embargo.json":"835449d98b03d5d6ff2bd412b91567eb90dc4f181fd463c1a03e27da48d5fc09","src/lib.rs":"57d02cd4f63fea2f731b13b0f57d044fe8de5f66586a5d0f53d1e9159b3f821b","tests/glob-std.rs":"6a2870563677f30c89621489320114738f811aa839d1f35bf94ec8251cf5b4fe","triagebot.toml":"26772e45fe413284e600760236cfd60cb726b7ae47fde22f2f9c474bd27ff8b0"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"ae557f3c5767619683fb8e1984ad583a77abae31389f62f253a96fdfc63423d5","Android.bp":"762fed9f6a48885b941666fc80aea256e62ac19c5e6a307827353a8d0459625a","CHANGELOG.md":"7feee48475b592d2d959405781a99681a181ff9186aa2fd1205ed19090346d0b","Cargo.toml":"5dccc7bdbde6dcd53bbfb87bccffeb4ddea12ba7b237751b73488f29d1c1428a","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"16693a68efd65bc6a9df3448c8f7ee6745418c73faff4ec4d443648c04285fa4","METADATA":"92b39b23acc9ebdb746c462c9123bfcdff272fbc7186632f0f424d385fb69bdf","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"8f98d8cbf55a6dd30313b80844fb06971334a66fe1b86164044369d35f29f912","TEST_MAPPING":"b980f27af06453e486aff3e93847a38c3886881743d109a9d083b8e6b60bee1d","cargo_embargo.json":"835449d98b03d5d6ff2bd412b91567eb90dc4f181fd463c1a03e27da48d5fc09","src/lib.rs":"b6eb28092e25512f3bac59134072b036ad34b546d8317ff49f16173b9a3025a6","tests/glob-std.rs":"0c22b6efd6add7f65e26502a10a4f1902709e98a56b6373ac4072ac8e86279b5","triagebot.toml":"26772e45fe413284e600760236cfd60cb726b7ae47fde22f2f9c474bd27ff8b0"}}
\ No newline at end of file
diff --git a/crates/glob/.cargo-checksum.json b/crates/glob/.cargo-checksum.json
index e31f7a6..aebac2d 100644
--- a/crates/glob/.cargo-checksum.json
+++ b/crates/glob/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"6791dcdd292ecaeeec9535afae7189026dca9d8486211acd27208673edfa995a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"3482ed957e7e22efdf5f368d92c497b932c665bce3ad17db8ec31c1007164539","src/lib.rs":"b2f3c3f48eb07f1767a7e5bb02847d10e02655f1dbf57281eb63fd001427e28b","tests/glob-std.rs":"b0a0aa11d7b8cc2cc0216fb117a543d6e584eec8b51173994dfd19761ab00a62","triagebot.toml":"a135e10c777cd13459559bdf74fb704c1379af7c9b0f70bc49fa6f5a837daa81"},"package":"d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"1d58b475783a53a2c20c8682dd666c0b3d95e3923b85c5b03eb577762178ea90","Cargo.toml":"b0fe646251875bd2b4ac71d55758fce1a58499a381d889cdec6c294064413410","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"8f2d321242fc17deb4e61d9cfbaec7b68ff532e0f458190d01668b37e34bfc2f","src/lib.rs":"eceab024b44237b5960e6c3625a0449c15bcf8409fa52401c83d4287f2c0fbce","tests/glob-std.rs":"83bf0b8371190832e85ed1ab8a335df3d8c03fab529694577d722dd1a0a5f398","triagebot.toml":"a135e10c777cd13459559bdf74fb704c1379af7c9b0f70bc49fa6f5a837daa81"},"package":"a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"}
\ No newline at end of file
diff --git a/crates/glob/Android.bp b/crates/glob/Android.bp
index 9f58735..154f0cc 100644
--- a/crates/glob/Android.bp
+++ b/crates/glob/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "glob",
cargo_env_compat: true,
- cargo_pkg_version: "0.3.1",
+ cargo_pkg_version: "0.3.2",
crate_root: "src/lib.rs",
edition: "2015",
apex_available: [
diff --git a/crates/glob/CHANGELOG.md b/crates/glob/CHANGELOG.md
new file mode 100644
index 0000000..11d7f62
--- /dev/null
+++ b/crates/glob/CHANGELOG.md
@@ -0,0 +1,33 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+## [Unreleased]
+
+## [0.3.2](https://github.com/rust-lang/glob/compare/v0.3.1...v0.3.2) - 2024-12-28
+
+## What's Changed
+* Add fs::symlink_metadata to detect broken symlinks by @kyoheiu in https://github.com/rust-lang/glob/pull/105
+* Add support for windows verbatim disk paths by @nico-abram in https://github.com/rust-lang/glob/pull/112
+* Respect `require_literal_leading_dot` option in `glob_with` method for path components by @JohnTitor in https://github.com/rust-lang/glob/pull/128
+* Harden tests for symlink by @JohnTitor in https://github.com/rust-lang/glob/pull/127
+* Remove "extern crate" directions from README by @zmitchell in https://github.com/rust-lang/glob/pull/131
+* Add FIXME for tempdir by @JohnTitor in https://github.com/rust-lang/glob/pull/126
+* Cache information about file type by @Kobzol in https://github.com/rust-lang/glob/pull/135
+* Document the behaviour of ** with files by @Wilfred in https://github.com/rust-lang/glob/pull/138
+* Add dependabot by @oriontvv in https://github.com/rust-lang/glob/pull/139
+* Bump actions/checkout from 3 to 4 by @dependabot in https://github.com/rust-lang/glob/pull/140
+* Check only (no longer test) at the MSRV by @tgross35 in https://github.com/rust-lang/glob/pull/151
+* Add release-plz for automated releases by @tgross35 in https://github.com/rust-lang/glob/pull/150
+
+## New Contributors
+* @kyoheiu made their first contribution in https://github.com/rust-lang/glob/pull/105
+* @nico-abram made their first contribution in https://github.com/rust-lang/glob/pull/112
+* @zmitchell made their first contribution in https://github.com/rust-lang/glob/pull/131
+* @Kobzol made their first contribution in https://github.com/rust-lang/glob/pull/135
+* @Wilfred made their first contribution in https://github.com/rust-lang/glob/pull/138
+* @oriontvv made their first contribution in https://github.com/rust-lang/glob/pull/139
+* @dependabot made their first contribution in https://github.com/rust-lang/glob/pull/140
+* @tgross35 made their first contribution in https://github.com/rust-lang/glob/pull/151
+
+**Full Changelog**: https://github.com/rust-lang/glob/compare/0.3.1...0.3.2
diff --git a/crates/glob/Cargo.toml b/crates/glob/Cargo.toml
index 5397717..59393e1 100644
--- a/crates/glob/Cargo.toml
+++ b/crates/glob/Cargo.toml
@@ -10,9 +10,16 @@
# See Cargo.toml.orig for the original contents.
[package]
+rust-version = "1.23.0"
name = "glob"
-version = "0.3.1"
+version = "0.3.2"
authors = ["The Rust Project Developers"]
+build = false
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = """
Support for matching file paths against Unix shell style patterns.
"""
@@ -23,6 +30,14 @@
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/glob"
+[lib]
+name = "glob"
+path = "src/lib.rs"
+
+[[test]]
+name = "glob-std"
+path = "tests/glob-std.rs"
+
[dev-dependencies.doc-comment]
version = "0.3"
diff --git a/crates/glob/METADATA b/crates/glob/METADATA
index b4815a1..6238def 100644
--- a/crates/glob/METADATA
+++ b/crates/glob/METADATA
@@ -1,17 +1,17 @@
name: "glob"
description: "Support for matching file paths against Unix shell style patterns."
third_party {
- version: "0.3.1"
+ version: "0.3.2"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 2
- day: 2
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/glob"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/glob/glob-0.3.1.crate"
- version: "0.3.1"
+ value: "https://static.crates.io/crates/glob/glob-0.3.2.crate"
+ version: "0.3.2"
}
}
diff --git a/crates/glob/README.md b/crates/glob/README.md
index b68a40e..36302ee 100644
--- a/crates/glob/README.md
+++ b/crates/glob/README.md
@@ -16,8 +16,7 @@
glob = "0.3.1"
```
-And add this to your crate root:
-
+If you're using Rust 1.30 or earlier, or edition 2015, add this to your crate root:
```rust
extern crate glob;
```
diff --git a/crates/glob/src/lib.rs b/crates/glob/src/lib.rs
index 744cabf..fef8090 100644
--- a/crates/glob/src/lib.rs
+++ b/crates/glob/src/lib.rs
@@ -73,7 +73,9 @@
use std::error::Error;
use std::fmt;
use std::fs;
+use std::fs::DirEntry;
use std::io;
+use std::ops::Deref;
use std::path::{self, Component, Path, PathBuf};
use std::str::FromStr;
@@ -96,8 +98,8 @@
dir_patterns: Vec<Pattern>,
require_dir: bool,
options: MatchOptions,
- todo: Vec<Result<(PathBuf, usize), GlobError>>,
- scope: Option<PathBuf>,
+ todo: Vec<Result<(PathWrapper, usize), GlobError>>,
+ scope: Option<PathWrapper>,
}
/// Return an iterator that produces all the `Path`s that match the given
@@ -178,7 +180,15 @@
#[cfg(windows)]
fn check_windows_verbatim(p: &Path) -> bool {
match p.components().next() {
- Some(Component::Prefix(ref p)) => p.kind().is_verbatim(),
+ Some(Component::Prefix(ref p)) => {
+ // Allow VerbatimDisk paths. std canonicalize() generates them, and they work fine
+ p.kind().is_verbatim()
+ && if let std::path::Prefix::VerbatimDisk(_) = p.kind() {
+ false
+ } else {
+ true
+ }
+ }
_ => false,
}
}
@@ -234,6 +244,7 @@
}
let scope = root.map_or_else(|| PathBuf::from("."), to_scope);
+ let scope = PathWrapper::from_path(scope);
let mut dir_patterns = Vec::new();
let components =
@@ -315,8 +326,52 @@
}
}
-fn is_dir(p: &Path) -> bool {
- fs::metadata(p).map(|m| m.is_dir()).unwrap_or(false)
+#[derive(Debug)]
+struct PathWrapper {
+ path: PathBuf,
+ is_directory: bool,
+}
+
+impl PathWrapper {
+ fn from_dir_entry(path: PathBuf, e: DirEntry) -> Self {
+ let is_directory = e
+ .file_type()
+ .ok()
+ .and_then(|file_type| {
+ // We need to use fs::metadata to resolve the actual path
+ // if it's a symlink.
+ if file_type.is_symlink() {
+ None
+ } else {
+ Some(file_type.is_dir())
+ }
+ })
+ .or_else(|| fs::metadata(&path).map(|m| m.is_dir()).ok())
+ .unwrap_or(false);
+ Self { path, is_directory }
+ }
+ fn from_path(path: PathBuf) -> Self {
+ let is_directory = fs::metadata(&path).map(|m| m.is_dir()).unwrap_or(false);
+ Self { path, is_directory }
+ }
+
+ fn into_path(self) -> PathBuf {
+ self.path
+ }
+}
+
+impl Deref for PathWrapper {
+ type Target = Path;
+
+ fn deref(&self) -> &Self::Target {
+ self.path.deref()
+ }
+}
+
+impl AsRef<Path> for PathWrapper {
+ fn as_ref(&self) -> &Path {
+ self.path.as_ref()
+ }
}
/// An alias for a glob iteration result.
@@ -355,10 +410,10 @@
// idx -1: was already checked by fill_todo, maybe path was '.' or
// '..' that we can't match here because of normalization.
if idx == !0 as usize {
- if self.require_dir && !is_dir(&path) {
+ if self.require_dir && !path.is_directory {
continue;
}
- return Some(Ok(path));
+ return Some(Ok(path.into_path()));
}
if self.dir_patterns[idx].is_recursive {
@@ -371,7 +426,7 @@
next += 1;
}
- if is_dir(&path) {
+ if path.is_directory {
// the path is a directory, so it's a match
// push this directory's contents
@@ -386,7 +441,7 @@
if next == self.dir_patterns.len() - 1 {
// pattern ends in recursive pattern, so return this
// directory as a result
- return Some(Ok(path));
+ return Some(Ok(path.into_path()));
} else {
// advanced to the next pattern for this path
idx = next + 1;
@@ -419,8 +474,8 @@
// *AND* its children so we don't need to check the
// children
- if !self.require_dir || is_dir(&path) {
- return Some(Ok(path));
+ if !self.require_dir || path.is_directory {
+ return Some(Ok(path.into_path()));
}
} else {
fill_todo(
@@ -469,10 +524,14 @@
///
/// - `*` matches any (possibly empty) sequence of characters.
///
-/// - `**` matches the current directory and arbitrary subdirectories. This
-/// sequence **must** form a single path component, so both `**a` and `b**`
-/// are invalid and will result in an error. A sequence of more than two
-/// consecutive `*` characters is also invalid.
+/// - `**` matches the current directory and arbitrary
+/// subdirectories. To match files in arbitrary subdiretories, use
+/// `**/*`.
+///
+/// This sequence **must** form a single path component, so both
+/// `**a` and `b**` are invalid and will result in an error. A
+/// sequence of more than two consecutive `*` characters is also
+/// invalid.
///
/// - `[...]` matches any character inside the brackets. Character sequences
/// can also specify ranges of characters, as ordered by Unicode, so e.g.
@@ -809,10 +868,10 @@
// special-casing patterns to match `.` and `..`, and avoiding `readdir()`
// calls when there are no metacharacters in the pattern.
fn fill_todo(
- todo: &mut Vec<Result<(PathBuf, usize), GlobError>>,
+ todo: &mut Vec<Result<(PathWrapper, usize), GlobError>>,
patterns: &[Pattern],
idx: usize,
- path: &Path,
+ path: &PathWrapper,
options: MatchOptions,
) {
// convert a pattern that's just many Char(_) to a string
@@ -828,7 +887,7 @@
Some(s)
}
- let add = |todo: &mut Vec<_>, next_path: PathBuf| {
+ let add = |todo: &mut Vec<_>, next_path: PathWrapper| {
if idx + 1 == patterns.len() {
// We know it's good, so don't make the iterator match this path
// against the pattern again. In particular, it can't match
@@ -840,8 +899,8 @@
};
let pattern = &patterns[idx];
- let is_dir = is_dir(path);
- let curdir = path == Path::new(".");
+ let is_dir = path.is_directory;
+ let curdir = path.as_ref() == Path::new(".");
match pattern_as_str(pattern) {
Some(s) => {
// This pattern component doesn't have any metacharacters, so we
@@ -855,7 +914,12 @@
} else {
path.join(&s)
};
- if (special && is_dir) || (!special && fs::metadata(&next_path).is_ok()) {
+ let next_path = PathWrapper::from_path(next_path);
+ if (special && is_dir)
+ || (!special
+ && (fs::metadata(&next_path).is_ok()
+ || fs::symlink_metadata(&next_path).is_ok()))
+ {
add(todo, next_path);
}
}
@@ -863,17 +927,22 @@
let dirs = fs::read_dir(path).and_then(|d| {
d.map(|e| {
e.map(|e| {
- if curdir {
+ let path = if curdir {
PathBuf::from(e.path().file_name().unwrap())
} else {
e.path()
- }
+ };
+ PathWrapper::from_dir_entry(path, e)
})
})
.collect::<Result<Vec<_>, _>>()
});
match dirs {
Ok(mut children) => {
+ if options.require_literal_leading_dot {
+ children
+ .retain(|x| !x.file_name().unwrap().to_str().unwrap().starts_with("."));
+ }
children.sort_by(|p1, p2| p2.file_name().cmp(&p1.file_name()));
todo.extend(children.into_iter().map(|x| Ok((x, idx))));
@@ -885,7 +954,7 @@
if !pattern.tokens.is_empty() && pattern.tokens[0] == Char('.') {
for &special in &[".", ".."] {
if pattern.matches_with(special, options) {
- add(todo, path.join(special));
+ add(todo, PathWrapper::from_path(path.join(special)));
}
}
}
@@ -1097,15 +1166,13 @@
// check windows absolute paths with host/device components
let root_with_device = current_dir()
.ok()
- .and_then(|p| {
- match p.components().next().unwrap() {
- Component::Prefix(prefix_component) => {
- let path = Path::new(prefix_component.as_os_str());
- path.join("*");
- Some(path.to_path_buf())
- }
- _ => panic!("no prefix in this path"),
+ .and_then(|p| match p.components().next().unwrap() {
+ Component::Prefix(prefix_component) => {
+ let path = Path::new(prefix_component.as_os_str());
+ path.join("*");
+ Some(path.to_path_buf())
}
+ _ => panic!("no prefix in this path"),
})
.unwrap();
// FIXME (#9639): This needs to handle non-utf8 paths
diff --git a/crates/glob/tests/glob-std.rs b/crates/glob/tests/glob-std.rs
index 085eb6d..4466413 100644
--- a/crates/glob/tests/glob-std.rs
+++ b/crates/glob/tests/glob-std.rs
@@ -15,7 +15,7 @@
extern crate glob;
extern crate tempdir;
-use glob::glob;
+use glob::{glob, glob_with};
use std::env;
use std::fs;
use std::path::PathBuf;
@@ -31,10 +31,40 @@
}
}
+ fn mk_symlink_file(original: &str, link: &str) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::symlink;
+ symlink(original, link).unwrap();
+ }
+ #[cfg(windows)]
+ {
+ use std::os::windows::fs::symlink_file;
+ symlink_file(original, link).unwrap();
+ }
+ }
+
+ fn mk_symlink_dir(original: &str, link: &str) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::symlink;
+ symlink(original, link).unwrap();
+ }
+ #[cfg(windows)]
+ {
+ use std::os::windows::fs::symlink_dir;
+ symlink_dir(original, link).unwrap();
+ }
+ }
+
fn glob_vec(pattern: &str) -> Vec<PathBuf> {
glob(pattern).unwrap().map(|r| r.unwrap()).collect()
}
+ fn glob_with_vec(pattern: &str, options: glob::MatchOptions) -> Vec<PathBuf> {
+ glob_with(pattern, options).unwrap().map(|r| r.unwrap()).collect()
+ }
+
let root = TempDir::new("glob-tests");
let root = root.ok().expect("Should have created a temp directory");
assert!(env::set_current_dir(root.path()).is_ok());
@@ -48,6 +78,10 @@
mk_file("bbb", true);
mk_file("bbb/specials", true);
mk_file("bbb/specials/!", false);
+ // a valid symlink
+ mk_symlink_file("aaa/apple", "aaa/green_apple");
+ // a broken symlink
+ mk_symlink_file("aaa/setsuna", "aaa/kazusa");
// windows does not allow `*` or `?` characters to exist in filenames
if env::consts::FAMILY != "windows" {
@@ -78,6 +112,22 @@
mk_file("r/three", true);
mk_file("r/three/c.md", false);
+ mk_file("dirsym", true);
+ mk_symlink_dir(root.path().join("r").to_str().unwrap(), "dirsym/link");
+
+ assert_eq!(
+ glob_vec("dirsym/**/*.md"),
+ vec!(
+ PathBuf::from("dirsym/link/another/a.md"),
+ PathBuf::from("dirsym/link/current_dir.md"),
+ PathBuf::from("dirsym/link/one/a.md"),
+ PathBuf::from("dirsym/link/one/another/a.md"),
+ PathBuf::from("dirsym/link/one/another/deep/spelunking.md"),
+ PathBuf::from("dirsym/link/three/c.md"),
+ PathBuf::from("dirsym/link/two/b.md")
+ )
+ );
+
// all recursive entities
assert_eq!(
glob_vec("r/**"),
@@ -91,6 +141,25 @@
)
);
+ // std-canonicalized windows verbatim disk paths should work
+ if env::consts::FAMILY == "windows" {
+ let r_verbatim = PathBuf::from("r").canonicalize().unwrap();
+ assert_eq!(
+ glob_vec(&format!("{}\\**", r_verbatim.display().to_string()))
+ .into_iter()
+ .map(|p| p.strip_prefix(&r_verbatim).unwrap().to_owned())
+ .collect::<Vec<_>>(),
+ vec!(
+ PathBuf::from("another"),
+ PathBuf::from("one"),
+ PathBuf::from("one\\another"),
+ PathBuf::from("one\\another\\deep"),
+ PathBuf::from("three"),
+ PathBuf::from("two")
+ )
+ );
+ }
+
// collapse consecutive recursive patterns
assert_eq!(
glob_vec("r/**/**"),
@@ -223,8 +292,10 @@
glob_vec("aaa/*"),
vec!(
PathBuf::from("aaa/apple"),
+ PathBuf::from("aaa/green_apple"),
+ PathBuf::from("aaa/kazusa"),
PathBuf::from("aaa/orange"),
- PathBuf::from("aaa/tomato")
+ PathBuf::from("aaa/tomato"),
)
);
@@ -232,6 +303,8 @@
glob_vec("aaa/*a*"),
vec!(
PathBuf::from("aaa/apple"),
+ PathBuf::from("aaa/green_apple"),
+ PathBuf::from("aaa/kazusa"),
PathBuf::from("aaa/orange"),
PathBuf::from("aaa/tomato")
)
@@ -262,6 +335,9 @@
assert_eq!(glob_vec("aaa/tomato/tomato.txt/"), Vec::<PathBuf>::new());
+ // Ensure to find a broken symlink.
+ assert_eq!(glob_vec("aaa/kazusa"), vec!(PathBuf::from("aaa/kazusa")));
+
assert_eq!(glob_vec("aa[a]"), vec!(PathBuf::from("aaa")));
assert_eq!(glob_vec("aa[abc]"), vec!(PathBuf::from("aaa")));
assert_eq!(glob_vec("a[bca]a"), vec!(PathBuf::from("aaa")));
@@ -288,6 +364,27 @@
vec!(PathBuf::from("bbb/specials/]"))
);
+ mk_file("i", true);
+ mk_file("i/qwe", true);
+ mk_file("i/qwe/.aaa", false);
+ mk_file("i/qwe/.bbb", true);
+ mk_file("i/qwe/.bbb/ccc", false);
+ mk_file("i/qwe/.bbb/.ddd", false);
+ mk_file("i/qwe/eee", false);
+
+ let options = glob::MatchOptions {
+ case_sensitive: false,
+ require_literal_separator: true,
+ require_literal_leading_dot: true,
+ };
+ assert_eq!(glob_with_vec("i/**/*a*", options), Vec::<PathBuf>::new());
+ assert_eq!(glob_with_vec("i/**/*c*", options), Vec::<PathBuf>::new());
+ assert_eq!(glob_with_vec("i/**/*d*", options), Vec::<PathBuf>::new());
+ assert_eq!(
+ glob_with_vec("i/**/*e*", options),
+ vec!(PathBuf::from("i/qwe"), PathBuf::from("i/qwe/eee"))
+ );
+
if env::consts::FAMILY != "windows" {
assert_eq!(
glob_vec("bbb/specials/[*]"),
diff --git a/crates/itertools/.android-checksum.json b/crates/itertools/.android-checksum.json
index bad3edd..1d505e1 100644
--- a/crates/itertools/.android-checksum.json
+++ b/crates/itertools/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"257dc46557410c03abd76c73a69f9adf3e564bbbea257a4b98eeb26162b7f207","Android.bp":"5ee265653e6582d25b05825dc8a2e7e41729cde2b8e667337d995624e817789d","CHANGELOG.md":"f1847e87f3097ef6f806ea99742d417c54cef0c02c96c8a52df8f43f9c92f0db","CONTRIBUTING.md":"0d7ab7d906e3ffb5f7c83efeefe84579106cc9f12a87886f03fdb0ddc5b8f81e","Cargo.lock":"32bc950e9dd34296698a2d5c3ce1e60aa1d7a0526578ae3fa6aeab144dbc41a7","Cargo.toml":"e762efee6c058e7b9ee88bd45fd9fd7aa55bfd288a9af6baafe5dfcae6d192a5","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"25045647f8514b43237cf0efdc4ba7dc153f8793e19c9e4b4a65af7e1b78cb5b","METADATA":"f3168c1900d70cac03a3469f5f523109e334aa59e35b95e8724c91a260506fbb","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"9cde44f0b329cdf3c255738ca84b60032f6280349ed2bc63270a4556fb39a065","TEST_MAPPING":"07d90e0d0888f048c20648fd613f2d89945853092265fa9346a3d4254bf0de17","benches/bench1.rs":"3d593f853938bf0d3eaeed26cd39a3afb90c48a8e799a4d4ff0dc26c5eee85f1","benches/combinations.rs":"9b36ec7cf395c2d8892a027914d57b114302f9a0a499959a1ad1c8942742daf8","benches/combinations_with_replacement.rs":"9fa18af6ddfc6f812fcaca4bc77fba4d4a04577251e2bcc25ff2bf5b9478bcdd","benches/fold_specialization.rs":"048b22ee15ca3c8f2da52ea3394527106cd1d8296d59898a7f84ff85c79e68a9","benches/powerset.rs":"47fe0d3cb3ba056283b88d7250c4f250b58b98020aed775a3ee03d26cf63fed4","benches/specializations.rs":"58cf97f0c51b48a491b897f5e5c6ff90854b871f53a27f19db52d2cd44998442","benches/tree_reduce.rs":"88c65e4da528f6df83a37eb720a8441eb284e872a5daf184a1004109937417f3","benches/tuple_combinations.rs":"4bc2c02549fd3aac467fd2c40e4f3134901ef2cecc67d3ace338d42f5d7bddd8","benches/tuples.rs":"07a663fced16df1e519110ba5c2dd9483955f2f21e8fc5171eea60d52bc715d0","cargo_embargo.json":"1c412d446965f40b1f2eb1d39291bb0e0732cc3b9c5fb36737f432d930e23c6e","examples/iris.data":"f952e90ad557c796d4834705174aaf71bb0a235dd09ca9407eff9b5b72a9f76f","examples/iris.rs":"6c3b8e2763ee4fdec1ecd7a4942b2d1bbf71d9658feb866b7420cb7512945c99","src/adaptors/coalesce.rs":"0a14e65588912e47c86c4cc43be4173992ac69958e73e4ca75406bf1a72787c1","src/adaptors/map.rs":"d0d5adb862ba83a9ff8d7bc2c2aa3e794a00639cb93a8355b4388c3d726d5c22","src/adaptors/mod.rs":"87833680388fc63edb2f4c9775a20e2e7e9055da0b527aeeecac9c9c1ffa8ef4","src/adaptors/multi_product.rs":"833ccc206e0d6d0a6e5ec95835c6ef87b9c6ff0db510c3aaf9a5627cd5061feb","src/combinations.rs":"1cea853cdba4b0254520e19129266651dec5a874cd386d7df80f74c05a0f16f3","src/combinations_with_replacement.rs":"7ebf227e9a1999a302e3f4642f27b39a96bad81760a8e0a19c4ec5eb1a20559c","src/concat_impl.rs":"4c0774db0f60c30214dafa73441676e7e81a4d6d64e579a80cc1a3092852266b","src/cons_tuples_impl.rs":"8fe663096421ee4cb48433298d2d3dd574261219004cf862d763256ef0f5073e","src/diff.rs":"a75dbab47313046304d8accbb1a4511800a90a5da861fa800a1bf4a5a04eca3f","src/duplicates_impl.rs":"dd3d4e04af8a85479658115105646159640c1a2b9d2216f251922c97da8b2f49","src/either_or_both.rs":"7c990e808fd7ae8b855a8383be7cc77e7aa3b5fe52044c4a662f2e47e94a9c68","src/exactly_one_err.rs":"558badd3aad0c38c4344a8e1469af442043304af51cde3fb9b41ad4c1581f349","src/extrema_set.rs":"15e5e133bb8efa2a99e8d68b8cbf5466cad6d3d7a5baec1b11a467cb7511da5e","src/flatten_ok.rs":"0bd61298617834e035c68ac9e485bae7f9d89d0fa07b5a2a84818bbddc92abd4","src/format.rs":"266506a1caa9b14caed9a4c4ff0564025d5726fb5119c79db8489635a3f453de","src/free.rs":"75ca79438588826fa2aec14097197a0af139786417dc0902d04f7a8337fd40b1","src/group_map.rs":"f2e97e58f03f36a01e31da3f912bfe1dcd4b456d5c6e05f540c4ec8344891b4b","src/groupbylazy.rs":"6b27e9c5c801e54946dec9e29c5d4bca290d7200a84d4c93a8e4af3ad8c9e3cf","src/grouping_map.rs":"0b62f8987d14956ee7bfdb1d5bbdfe9f01e17b1585647f9ad310332e74ce2e7f","src/impl_macros.rs":"29d480f310b17a1e8c68504d1be6024a3ccf9b4350a93b2cd6ea9b7be279ac6a","src/intersperse.rs":"481b6729e3f98cd62405f0c181aa2bb528508bd084bf3a3054d57c810f6e5c43","src/iter_index.rs":"1d68bf19eed6f975d06131638534e5a7b382f5b03aeb29e1107412bb08ce36a1","src/k_smallest.rs":"ffda60dd32d662c75d3ed9cfa849458e5322fc20ecab0d2dd8cc75c9cbe9c753","src/kmerge_impl.rs":"eaff0331e8a85b5b6a2a3a2041e5546b6d765a2ea0fc948f570d577d8fc646a0","src/lazy_buffer.rs":"8fd6ff0e0700ad6f22543a9cfe209cd10e2284a2c63b769e2cfb9349e154c7d7","src/lib.rs":"590fe6fe598de46afb7eadc289438730913a7236b9a71fbb70db76855ac584dc","src/merge_join.rs":"91f824fb58859d0a0b7925f530a64e91218baf46feece8b5b76974ae5f05f8aa","src/minmax.rs":"6c1eb4f9048153adb841adcbc33c78f237fbadd3b8705289a9fef104b4920693","src/multipeek_impl.rs":"502c545ab39b8db9ea5482b37226c02290aa5ba169b58a9c2427bb38a6f18628","src/pad_tail.rs":"91babaf864d230a402d63c959f1d87a0ff6b6881bb582b213896f7fe5fa61d14","src/peek_nth.rs":"b293ccc75f50919d44653f4453cd27a28bd33f21448df57b1f87a72e38941417","src/peeking_take_while.rs":"9e0bd09c19ed1df98772b43ed16a646d6887ecb6af73e5ebf22889065fd0d770","src/permutations.rs":"1cc667ff17fa7b3a9227f7a96cb861770228c3a1cabb6e0a515cd46ab8ef46c3","src/powerset.rs":"2a55d1100eda58c94a0843a639120df6d26b15318c659404654fcfea0275880e","src/process_results_impl.rs":"1196dae4ae1118e090b46def6b4f4519392000f811c7a9ced031628553f63233","src/put_back_n_impl.rs":"da1b66a391cb0b1d5467fd6257e1dcc86b90a2c12ed03c0bd6cad73a71c3414d","src/rciter_impl.rs":"7774181fcf4b70155123faacd512ba059d18ef05a5a3dd7fb5fab61d7540d99f","src/repeatn.rs":"4d5be3a1d97e91ee94fdc8d508ebe7fb815279db1b06d0e38ddf69e58475ed4a","src/size_hint.rs":"3ef07e7c3fa75bd1469de67452f8eb992a4d6c3e7839e79ff883bfb02ed65839","src/sources.rs":"b9d87801a0c1d39efb657a6f4fa33e95e71fab2230a8e2ae3d02bb686f42cb99","src/take_while_inclusive.rs":"ec3a8501a874422d8a7e6f556c949cc411180e43116ed7fa5f92954829eb56da","src/tee.rs":"9f97c5b4bb44ce437b51e92619274a488bd32eab8a9897c192e64dea9d5fbd9b","src/tuple_impl.rs":"0ece5c00544ffe88c61d89ad7bb997127c86764f17fe1a53e6a0c019ba185984","src/unique_impl.rs":"a99c3ae80697791d7b663b1d8a981fdcfe6e1ca67155c4ac87b4ad1d8fb6e18e","src/unziptuple.rs":"e26d5ab3e522604e84b5286ab0d7f608394677db3b9a69beeb4d557f5871f8d4","src/with_position.rs":"9cdd85aa92ccdadf88dfcd9643a69af6d3e053c5597ef3b00ee62fdc5bbc611d","src/zip_eq_impl.rs":"38fa6317618064c666be842ac1452c04b4f90d2e90e4e2a54266312a13963031","src/zip_longest.rs":"3f9003b0b7c050d53f48d2d36997ea45bb428fa74e5ba13d1df98205f7a51084","src/ziptuple.rs":"552ab217529b637f12b5e39702008f0ac91d2dc0b5d5819b839766d740c64c9e","tests/adaptors_no_collect.rs":"1aa9c1a1f6144f7b7a126c1802c2a791e1bc7d0a6330971ab5d51c1f6ab9e2d9","tests/flatten_ok.rs":"05d7773126bc41913bd6a5db6617c4cf90bb051f6ad5e7c1718694b6a0b4e0c1","tests/laziness.rs":"660e0df9a95e5021d954b57fec5ca18aeb71a6fd8c13637faf0eef023642c084","tests/macros_hygiene.rs":"809cebecb915752fe8e2b5883f8725b0494181775ddbe231bb0945c686dc53b6","tests/merge_join.rs":"cf07e22a97cb496ae2a18ffbecaf797c9cc99f2a0de7958ebf0da86b21590cad","tests/peeking_take_while.rs":"8b0220981b437aa6756f2510ea4e25cf49a19a399a14a465dccff9ad08c48d55","tests/quick.rs":"700de3a8923974ee349a395febd047befb668b4aeb523cfa3c7d0442724ef8b4","tests/specializations.rs":"3d5e5305d4c23d780cd7003c78c87c9f8eccbf32d86680a6ad5da6c2081d7980","tests/test_core.rs":"c3986dcb99a72f8d36203a341acdd71771b96f354a2832f1b25ff0bc740bb6ae","tests/test_std.rs":"818af66b216bafdd527ff456ad4943187f28b59b9eb215c4c38981038192a988","tests/tuples.rs":"92df348f8816e17a3c02eeac420ae33e0a2c6ff994f8171aaecd3875863d2f0f","tests/zip.rs":"f1d057149f847eccaebc110b474df6bc6c65e002be09af64516c46675a10ba99"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"e4ab3828cab0255c2394a3c0b04bd22eeb1698b2fa7591a4e75b164c8f255260","Android.bp":"6db0a7d0d137b70817938262b39b68e4620d28ef2d1fb85d3cde789a9cff5874","CHANGELOG.md":"943156ca6b8384eb6ab7fd6b52ffb38f0874915fac724845fb1fde34ec56202a","CONTRIBUTING.md":"0d7ab7d906e3ffb5f7c83efeefe84579106cc9f12a87886f03fdb0ddc5b8f81e","Cargo.lock":"bc157173dcde8d4fcb537b05849527e45ba85d079866ae3027feb6d11bcfdaa7","Cargo.toml":"7ab158a0e9c5cac50f97adc234907c1569e51b2f9e47ba74addfd8540c8c337e","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"25045647f8514b43237cf0efdc4ba7dc153f8793e19c9e4b4a65af7e1b78cb5b","METADATA":"c48db4794e069d47a59163878e98a4854a6c7e40ff7bd9a512dddaa443b999bb","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"1b66d859b3ffc9629f9389d22b3ef05598e4675af432ba7ba7ba2fa474962174","TEST_MAPPING":"07d90e0d0888f048c20648fd613f2d89945853092265fa9346a3d4254bf0de17","benches/bench1.rs":"3d593f853938bf0d3eaeed26cd39a3afb90c48a8e799a4d4ff0dc26c5eee85f1","benches/combinations.rs":"9b36ec7cf395c2d8892a027914d57b114302f9a0a499959a1ad1c8942742daf8","benches/combinations_with_replacement.rs":"9fa18af6ddfc6f812fcaca4bc77fba4d4a04577251e2bcc25ff2bf5b9478bcdd","benches/fold_specialization.rs":"048b22ee15ca3c8f2da52ea3394527106cd1d8296d59898a7f84ff85c79e68a9","benches/k_smallest.rs":"bb2b1f1e05814a42da916884727ac550ee995c3b90070497c41d9906cbefbb1b","benches/powerset.rs":"47fe0d3cb3ba056283b88d7250c4f250b58b98020aed775a3ee03d26cf63fed4","benches/specializations.rs":"1662f3f02d989458de47c219ef6dd507f75ee9e0046fabd198ac4b2ddf83c299","benches/tree_reduce.rs":"88c65e4da528f6df83a37eb720a8441eb284e872a5daf184a1004109937417f3","benches/tuple_combinations.rs":"4bc2c02549fd3aac467fd2c40e4f3134901ef2cecc67d3ace338d42f5d7bddd8","benches/tuples.rs":"07a663fced16df1e519110ba5c2dd9483955f2f21e8fc5171eea60d52bc715d0","cargo_embargo.json":"1c412d446965f40b1f2eb1d39291bb0e0732cc3b9c5fb36737f432d930e23c6e","examples/iris.data":"f952e90ad557c796d4834705174aaf71bb0a235dd09ca9407eff9b5b72a9f76f","examples/iris.rs":"6c3b8e2763ee4fdec1ecd7a4942b2d1bbf71d9658feb866b7420cb7512945c99","src/adaptors/coalesce.rs":"0a14e65588912e47c86c4cc43be4173992ac69958e73e4ca75406bf1a72787c1","src/adaptors/map.rs":"d0d5adb862ba83a9ff8d7bc2c2aa3e794a00639cb93a8355b4388c3d726d5c22","src/adaptors/mod.rs":"42b75e89940d8ebb8cf8c16032d56100a12c73bc567316666d4710feec3e71b9","src/adaptors/multi_product.rs":"833ccc206e0d6d0a6e5ec95835c6ef87b9c6ff0db510c3aaf9a5627cd5061feb","src/combinations.rs":"011a33f4b1e2ae57380800d5878c27a736fab0ed7f3b676d0be655cdad8d22b7","src/combinations_with_replacement.rs":"1dd4c50b9add8cba32f47571449cd03bb93db52013c9e8ffe9ca3acb851c01c8","src/concat_impl.rs":"4ab66a9a9800bc20d061a23d6a7bca235f038865850860da77311a0ddf852fc1","src/cons_tuples_impl.rs":"cbfaec74702bb6397b1005b8460b1ba2cfb7c52771b9009dd730a8bff45c09b9","src/diff.rs":"a66f924d8f57718a36e13b5aee2fe142fbb4e2d8ab974a2a83c9f6405278d7d0","src/duplicates_impl.rs":"dd3d4e04af8a85479658115105646159640c1a2b9d2216f251922c97da8b2f49","src/either_or_both.rs":"7c990e808fd7ae8b855a8383be7cc77e7aa3b5fe52044c4a662f2e47e94a9c68","src/exactly_one_err.rs":"558badd3aad0c38c4344a8e1469af442043304af51cde3fb9b41ad4c1581f349","src/extrema_set.rs":"dbbb20f4f293a74dad55b0c0286a38b6849ce918c9085274aafbc7fbde9de013","src/flatten_ok.rs":"0bd61298617834e035c68ac9e485bae7f9d89d0fa07b5a2a84818bbddc92abd4","src/format.rs":"4c5f963ea4a9d4da941c2209496596d895d73db968b1e41b09be39589eb36ac6","src/free.rs":"b6f64938e164559b0a7eb2696d2f460efae6373f4edde12ce2d247b9a67bc526","src/group_map.rs":"f2e97e58f03f36a01e31da3f912bfe1dcd4b456d5c6e05f540c4ec8344891b4b","src/groupbylazy.rs":"6b27e9c5c801e54946dec9e29c5d4bca290d7200a84d4c93a8e4af3ad8c9e3cf","src/grouping_map.rs":"116a100889201637b519cc33dcf20fbf0ce403a1008fddc5f7dc82e6fb34fcf5","src/impl_macros.rs":"29d480f310b17a1e8c68504d1be6024a3ccf9b4350a93b2cd6ea9b7be279ac6a","src/intersperse.rs":"481b6729e3f98cd62405f0c181aa2bb528508bd084bf3a3054d57c810f6e5c43","src/iter_index.rs":"1d68bf19eed6f975d06131638534e5a7b382f5b03aeb29e1107412bb08ce36a1","src/k_smallest.rs":"381043da6b7af62574c5c5034dd55bb1eb7074cc32b1df1340c921e67463b150","src/kmerge_impl.rs":"9670e60ba6ef3c6c51713ccd3eee46f1744393daaa4833ebbe52df7c6965f3b6","src/lazy_buffer.rs":"0bf7a4fe8a7d3d23783bf61e674bfd0ba03cca55cc1d0549145758611f1bdbed","src/lib.rs":"a2156c5f51ce3559c21f6f5eb63e7d0c7fae75cc9e93ec54d09f106198507b07","src/merge_join.rs":"b7ef9d7a3654279e808f32b7751c752f2db5fa35521affd0ed560fa5303e06e1","src/minmax.rs":"6c1eb4f9048153adb841adcbc33c78f237fbadd3b8705289a9fef104b4920693","src/multipeek_impl.rs":"502c545ab39b8db9ea5482b37226c02290aa5ba169b58a9c2427bb38a6f18628","src/next_array.rs":"fd5904fc07fb4b9e4c48a2771a3d300ffabe9db0680ebe96ea754d21e6d2876f","src/pad_tail.rs":"91babaf864d230a402d63c959f1d87a0ff6b6881bb582b213896f7fe5fa61d14","src/peek_nth.rs":"b293ccc75f50919d44653f4453cd27a28bd33f21448df57b1f87a72e38941417","src/peeking_take_while.rs":"ff66fc7a97a9101a04ec5f4a0e56b5754c69ce7b27f3132c5d376b30a1f0b19d","src/permutations.rs":"1cc667ff17fa7b3a9227f7a96cb861770228c3a1cabb6e0a515cd46ab8ef46c3","src/powerset.rs":"2a55d1100eda58c94a0843a639120df6d26b15318c659404654fcfea0275880e","src/process_results_impl.rs":"67c7cd60171053c21939252b71aad6879d6ad251a6ea3d50af1ffb0d0b4241bd","src/put_back_n_impl.rs":"da1b66a391cb0b1d5467fd6257e1dcc86b90a2c12ed03c0bd6cad73a71c3414d","src/rciter_impl.rs":"3aa04cdf4cbd96ddff4b210e90652e346177663b1993836b0f88215043ab228b","src/repeatn.rs":"4d5be3a1d97e91ee94fdc8d508ebe7fb815279db1b06d0e38ddf69e58475ed4a","src/size_hint.rs":"3ef07e7c3fa75bd1469de67452f8eb992a4d6c3e7839e79ff883bfb02ed65839","src/sources.rs":"b9d87801a0c1d39efb657a6f4fa33e95e71fab2230a8e2ae3d02bb686f42cb99","src/take_while_inclusive.rs":"ec3a8501a874422d8a7e6f556c949cc411180e43116ed7fa5f92954829eb56da","src/tee.rs":"9f97c5b4bb44ce437b51e92619274a488bd32eab8a9897c192e64dea9d5fbd9b","src/tuple_impl.rs":"0ece5c00544ffe88c61d89ad7bb997127c86764f17fe1a53e6a0c019ba185984","src/unique_impl.rs":"a99c3ae80697791d7b663b1d8a981fdcfe6e1ca67155c4ac87b4ad1d8fb6e18e","src/unziptuple.rs":"e26d5ab3e522604e84b5286ab0d7f608394677db3b9a69beeb4d557f5871f8d4","src/with_position.rs":"9cdd85aa92ccdadf88dfcd9643a69af6d3e053c5597ef3b00ee62fdc5bbc611d","src/zip_eq_impl.rs":"10ea8763cf64c9f20172c5b041de10108f5c366f6f91bd153d00a8755d01ed94","src/zip_longest.rs":"3f9003b0b7c050d53f48d2d36997ea45bb428fa74e5ba13d1df98205f7a51084","src/ziptuple.rs":"552ab217529b637f12b5e39702008f0ac91d2dc0b5d5819b839766d740c64c9e","tests/adaptors_no_collect.rs":"1aa9c1a1f6144f7b7a126c1802c2a791e1bc7d0a6330971ab5d51c1f6ab9e2d9","tests/flatten_ok.rs":"05d7773126bc41913bd6a5db6617c4cf90bb051f6ad5e7c1718694b6a0b4e0c1","tests/laziness.rs":"660e0df9a95e5021d954b57fec5ca18aeb71a6fd8c13637faf0eef023642c084","tests/macros_hygiene.rs":"b5a9053e2a9fdc6a3f958092846b9201ae4c94a84cf853aafbd4079c8cc9aa50","tests/merge_join.rs":"cf07e22a97cb496ae2a18ffbecaf797c9cc99f2a0de7958ebf0da86b21590cad","tests/peeking_take_while.rs":"8b0220981b437aa6756f2510ea4e25cf49a19a399a14a465dccff9ad08c48d55","tests/quick.rs":"8673d4fa3aac895fddfbe0d772a162cb193cbd2f05e84ed89a281f66b4cbae99","tests/specializations.rs":"a7af5260416febe23c4175b6c744bfcaccc0ccff5034a9758b2f89ba837b7a24","tests/test_core.rs":"ff3e834c8a3cf0d12b2e4e90b696fd5406a9ca588517f5c5630c8fe5fae5556c","tests/test_std.rs":"4c761b1379cb4a48a8f995d7525f59263fd1942c33a486b72555f80115199d68","tests/tuples.rs":"92df348f8816e17a3c02eeac420ae33e0a2c6ff994f8171aaecd3875863d2f0f","tests/zip.rs":"3767be9b0e8bdbcf1a41a6230a968d14263cb5fb6941af4ecf4bbe7782a7a0b2"}}
\ No newline at end of file
diff --git a/crates/itertools/.cargo-checksum.json b/crates/itertools/.cargo-checksum.json
index 38bbe13..13a4681 100644
--- a/crates/itertools/.cargo-checksum.json
+++ b/crates/itertools/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"ceee4376468a3f7647f3bf4649e195a86873dd3091f23e3f992d248bd143fba2","CONTRIBUTING.md":"d5787d0fd4df15481e2e09a37234ac5dec22c007c890826991f633d890efa29e","Cargo.lock":"fd2c9ca8e299f51d7ed2a0f3760c393f03c544c817743ab7341c1f22b8c1d869","Cargo.toml":"49abb2101a0dd9cb137df206454b6620d04929a4975921fab6682ba834435620","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"fc812ab0d5756b62c2ae34f38365899204b53332d5e6a87a695b0fe15a466957","benches/bench1.rs":"d632c8b839d7b318d1cb7b81b9c62570c77dcdf0696b8ce3d52067c79c930f78","benches/combinations.rs":"5b3bd243336d6b6bdc111d66218f3f0a4ecdb10fb72e90db79959e3d8bb2cf6f","benches/combinations_with_replacement.rs":"11f29160652a2d90ce7ca4b1c339c4457888ab6867e2456ce1c62e3adf9be737","benches/fold_specialization.rs":"66ab13fd8576a662afb59ef72c5565f5c3d27f7f30a976450ee5a14958654fa2","benches/powerset.rs":"dc1fd729584147e5d8e4d19c6ca6f8706087d41c3c5beb7293d9ea43b4beab14","benches/specializations.rs":"d8320071a692147c1239881725079003be2f924f6124c3aa3bdf6a4596d66a66","benches/tree_reduce.rs":"fa4f22f042b76df89094ddf6e925ba42c4c3992f8195e719ed035f2e7cfa05bd","benches/tuple_combinations.rs":"16366158743307a0289fc1df423a3cec45009807d410a9fe9922d5b6f8b7d002","benches/tuples.rs":"5ab542aca40df4390de0ebf3819665df402d924a7dd6f4280e6ffc942bbd25c4","examples/iris.data":"596ffd580471ca4d4880f8e439c7281f3b50d8249a5960353cb200b1490f63a0","examples/iris.rs":"42c1b2fc148df52a050b013a57b577ad19911f1fe85b9525863df501979b5cd1","src/adaptors/coalesce.rs":"b57157c205ae077dd398740b61c7f49023aa80868abd8a071a6fe89ae6ecc9ad","src/adaptors/map.rs":"4952ee770cb54e98b2f649efd9c98f18951689358eb9b6bee10f139d056353ae","src/adaptors/mod.rs":"7064a1043baec815c02803d5043bd950e6a515f3a0247e44028ee080004dc225","src/adaptors/multi_product.rs":"ad501e8ae4e5089b9d2f2be1f9a4713da6a2103b14daa759e09918409f88e321","src/combinations.rs":"6c1cd55051eb59c595780b055ccabb07db72add134120dd8b2f5aa60c0f5fa6e","src/combinations_with_replacement.rs":"cad1885ca51e52a1dc324a0b06bd0d1d911f1dd58cf5d76bd9a9c78a09853b86","src/concat_impl.rs":"6094463eb57f77e115f6a3fe7f469992eef81c0c4caa9585b99a426d87f794fb","src/cons_tuples_impl.rs":"3ceee1ff0dbd4c3b43195a490b8f38b05de3a46e0fb691ba11fbbe1e7e3ad746","src/diff.rs":"046b3ac4a22036b9ec8741aba4e8f6729ae44bf14346b61c23192b88d9fc7c88","src/duplicates_impl.rs":"1be37249b4566edc8da611ed9766ec851a526e7513bd13d80fe97482dcfcf7f3","src/either_or_both.rs":"cac278666b5d3c1fd103d97d15ce4c40960ea459441aeae83c6502087fd2ad8d","src/exactly_one_err.rs":"90b6204551161d27394af72107765dbfe3b51a77f4770c2e506fa4938985a184","src/extrema_set.rs":"7e0d92ca1aafc1221e08d0297087b35373463d03228a0e65628cfd1734273e90","src/flatten_ok.rs":"62c18e5221a27949a00de49414306d6dfd601515817c1c8ae6189e3275756dd3","src/format.rs":"94675a6ac4500ec52bbf8463b2241b870fea8b5dd6b113accb8a00b2c1174871","src/free.rs":"6f3597a5ccf8a9b0606da7df6803f7368152ebcf7b7bcfd31b17fcff3a286139","src/group_map.rs":"c9da201137c6bb479b9308bfc38398b76950e39905f4ce8bc435c5318371522c","src/groupbylazy.rs":"5862629719258703aad47977ba1060f20fff15e962e18e6142758ebf6cd4a61c","src/grouping_map.rs":"8dac807a6cbf1893fdc147b4160000c452bfb5e533e1c774ed6bd3af91cf46da","src/impl_macros.rs":"97fc5f39574805e0c220aa462cf1ae7dcac5c1082d6ee5500e7d71c120db5f88","src/intersperse.rs":"55031819e985c3184275e254c9600ecbe01e9fb49f198039c5da82a87ea5b90e","src/iter_index.rs":"1b0ff8376a4ad855d44db8c662450c777db84e0f4997b53ca575c65b107bb83b","src/k_smallest.rs":"6a665742f6665e350a54ae3ff821252e7c599b57aee3239a03fa56a9d1930467","src/kmerge_impl.rs":"2e425d4189898566c5146e8f5bd258045c246f6babbe3ac5fef10ca08ae2efd2","src/lazy_buffer.rs":"a065f73c228f156bdf901824977ea9375f912823af4f9b05378e3f633d3b20e4","src/lib.rs":"75903dcd21573a8a77a205cfb8d335c60c2939771481c6431c29a0918d8dbfb0","src/merge_join.rs":"bb1fccddcc647fe21da1895a8808c06596d49900f5cf60a69a9c9141fc12af11","src/minmax.rs":"0ec34b172ca8efc4aacb96f3e5771bdc5e8ac882876ee0f59d698c3924717c48","src/multipeek_impl.rs":"79eef0be49ad66f15d41808e72c03976c4f7cff5838b69d17975d3ece266f3f8","src/pad_tail.rs":"e6bb5b086478600b0dbb8726cae8364bf83ab36d989ef467e1264eea43933b50","src/peek_nth.rs":"093f1a157b1c917f041af5244a5a46311affa2922126e36dc0ee2c501c79b58c","src/peeking_take_while.rs":"6967ba212f045145da7683a192471b2dcfcedf90d23922d70a5b7e2a1b36622e","src/permutations.rs":"b316084ee14e9e138d22f177367b3bfa24cb3e5e90ab20b9b00a9a23d653496f","src/powerset.rs":"7ab24fefc914b339dd92a6c8e639d0cad34479e09293b3346078856d6bc02d34","src/process_results_impl.rs":"a6f91aec53c56b042e15ecb8f8ca489c81e3ee92347dc9fa8352a5baac44a247","src/put_back_n_impl.rs":"5a58d7a31c03029f0726e4d42de3be869580cf76b73c6d1ef70dd40c240b03a0","src/rciter_impl.rs":"9a50cdc0106587be8ee49c2af5fcf84436b74d353c2846b401eb638c23b4733c","src/repeatn.rs":"dd9a5bf5a63ef9cc6ec5c8a6137c7ffba80f13568b6d001e189daaa29ffbaf39","src/size_hint.rs":"6022c2327ddc6df7e7b939eb60a93ee66ea9aa4d3aab49b9952e663ff4bff10b","src/sources.rs":"ef942af209ca1effcd28a95abedad8c45b659ae2a15b66c2158cb604f6e325f8","src/take_while_inclusive.rs":"1973a9f5322b3dae3b5ccded5912a08a8e2e975b9a5eac666192b118b230d305","src/tee.rs":"dad50ca162627cf0a67786f0993ef27d06cdefc14d412463e58c07824ef409d8","src/tuple_impl.rs":"0213261109e7c65746ccc22425d19141907bf7ea1e3dd4c40e9f278e6148e272","src/unique_impl.rs":"1efc280226f13ddd7dd5f7eedeec0093b704596652c942f3a0b2f8c90fa2e2f7","src/unziptuple.rs":"f3f6a2ee2658fa07db7592f2c344c2e3b1263a21fc75e1325f2be32c9dc1e750","src/with_position.rs":"9ca1eb195d04690b0c3a62a6c0eea349b8042e11c4ca4b80744f54103e1c7355","src/zip_eq_impl.rs":"4e0d38266c26982ea8b8d055994cb1298e93b7749caadbd7f25d2b6e0c8ce0d7","src/zip_longest.rs":"5572699564dd5717cc074b7733333ed238c2e9f3e6819d45e33e3a2dbda74478","src/ziptuple.rs":"d3a12221d39c8a5514574adb3ad2ccd1803d514b1cb09fbcd9253e3ddd628310","tests/adaptors_no_collect.rs":"7e6240878b1fc13b6384fdde0317d5d7ccca3e417b10a201ba61eb5255400fda","tests/flatten_ok.rs":"b7894874132918b8229c7150b2637511d8e3e14197d8eeb9382d46b2a514efa2","tests/laziness.rs":"89e6caec10da3d7aeadf9e30d5caf03cda36d07cee8415ff134b5b8e2a2cf144","tests/macros_hygiene.rs":"c9e9f0546a8c12ea52311c0eadd77d75c782d4e10ae9e74d410ea2861d526c66","tests/merge_join.rs":"5fb506b989f4a331d46cdec5775ea594656985134196099eaf8d3905bdddcdd5","tests/peeking_take_while.rs":"f834361c5520dda15eb9e9ebe87507c905462201412b21859d9f83dab91d0e0b","tests/quick.rs":"60b1ca6d820aa505545f20d6082fd08c1e0470b5326b711567ec1c93d07f9ced","tests/specializations.rs":"7c6a461850a2b4f783801ef23b2303ad985c58f2295c569001369b3c9d4c6e33","tests/test_core.rs":"482e077e0c5fe78ba0a8a126d8c0821162d820a21936855fadede713b1d4e70a","tests/test_std.rs":"f788573adc9ae19eb4bd2886c3967b273dd881982af407f6f5b6276434df0f00","tests/tuples.rs":"014e4da776174bfe923270e2a359cd9c95b372fce4b952b8138909d6e2c52762","tests/zip.rs":"2f68d531170fa2f106efafaf38ae854281d93305bf1b2b8d4bea833072518ecd"},"package":"413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"}
\ No newline at end of file
+{"files":{"CHANGELOG.md":"60ec9a1801e015e49f7fbb299b608ac730d5b1a3fb298e6cf7935c0695ddf7fe","CONTRIBUTING.md":"d5787d0fd4df15481e2e09a37234ac5dec22c007c890826991f633d890efa29e","Cargo.lock":"4422e732d4ce6f650afb53a1dcffb1e53c86dd066c3dcd66bc9620acd898b99e","Cargo.toml":"77735549383196a4156a2246dd1cd6742029b223679b3004531456d33562b0ce","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"7dba3f55ea54eff2606f8b9f005e369cf9885dd972cb481432fce00234ee7750","benches/bench1.rs":"d632c8b839d7b318d1cb7b81b9c62570c77dcdf0696b8ce3d52067c79c930f78","benches/combinations.rs":"5b3bd243336d6b6bdc111d66218f3f0a4ecdb10fb72e90db79959e3d8bb2cf6f","benches/combinations_with_replacement.rs":"11f29160652a2d90ce7ca4b1c339c4457888ab6867e2456ce1c62e3adf9be737","benches/fold_specialization.rs":"66ab13fd8576a662afb59ef72c5565f5c3d27f7f30a976450ee5a14958654fa2","benches/k_smallest.rs":"c1bb2aa597def7f7c282d1196f9d70be6d10e1acbae03279c05bc8065544bb8e","benches/powerset.rs":"dc1fd729584147e5d8e4d19c6ca6f8706087d41c3c5beb7293d9ea43b4beab14","benches/specializations.rs":"daa989877d83ccd58e8de529184d50905b3d6fa60a9eeae917f38bd570d72fa4","benches/tree_reduce.rs":"fa4f22f042b76df89094ddf6e925ba42c4c3992f8195e719ed035f2e7cfa05bd","benches/tuple_combinations.rs":"16366158743307a0289fc1df423a3cec45009807d410a9fe9922d5b6f8b7d002","benches/tuples.rs":"5ab542aca40df4390de0ebf3819665df402d924a7dd6f4280e6ffc942bbd25c4","examples/iris.data":"596ffd580471ca4d4880f8e439c7281f3b50d8249a5960353cb200b1490f63a0","examples/iris.rs":"42c1b2fc148df52a050b013a57b577ad19911f1fe85b9525863df501979b5cd1","src/adaptors/coalesce.rs":"b57157c205ae077dd398740b61c7f49023aa80868abd8a071a6fe89ae6ecc9ad","src/adaptors/map.rs":"4952ee770cb54e98b2f649efd9c98f18951689358eb9b6bee10f139d056353ae","src/adaptors/mod.rs":"1e0cf7409c7291a923cf87f1c6d27cc57bd9f71ca52f7dd08a429aa994daa6ce","src/adaptors/multi_product.rs":"ad501e8ae4e5089b9d2f2be1f9a4713da6a2103b14daa759e09918409f88e321","src/combinations.rs":"9c4490bc4c7488fe9a8dba656a30493d90abb33006f7abbe3e266c237ffc986b","src/combinations_with_replacement.rs":"c7d6b7a122057e9aab075b2de41440ccd2973a6985fba75c2e93af13de55ef90","src/concat_impl.rs":"d61c00d43eca1193f135e25d3b6afd840c02ef1c573c29b264c47ee3429a45e8","src/cons_tuples_impl.rs":"7f46da33168107860b2b15d05d8edfe618e41bbc66ff0e16baf82d7373c4356d","src/diff.rs":"6e5ba3705a3a076d4fc360594014c90f1dfc597e61e8a629f96efa050e2433f5","src/duplicates_impl.rs":"1be37249b4566edc8da611ed9766ec851a526e7513bd13d80fe97482dcfcf7f3","src/either_or_both.rs":"cac278666b5d3c1fd103d97d15ce4c40960ea459441aeae83c6502087fd2ad8d","src/exactly_one_err.rs":"90b6204551161d27394af72107765dbfe3b51a77f4770c2e506fa4938985a184","src/extrema_set.rs":"11de200d853941716e9aa9a9b520b006704827c3c43a0c5f067906b0941e51d1","src/flatten_ok.rs":"62c18e5221a27949a00de49414306d6dfd601515817c1c8ae6189e3275756dd3","src/format.rs":"3ae6414043e0040f7358028c560437ea49afdbb2416df138a2410169e2619589","src/free.rs":"00ec21acee2ae2b30bf99e62472f9684c0a1719fbafc8dd2e4195ea8377c5b5d","src/group_map.rs":"c9da201137c6bb479b9308bfc38398b76950e39905f4ce8bc435c5318371522c","src/groupbylazy.rs":"5862629719258703aad47977ba1060f20fff15e962e18e6142758ebf6cd4a61c","src/grouping_map.rs":"3896c46ba4bd8ea886e5344a245658235626a104758d5ccecf223544a9ba471b","src/impl_macros.rs":"97fc5f39574805e0c220aa462cf1ae7dcac5c1082d6ee5500e7d71c120db5f88","src/intersperse.rs":"55031819e985c3184275e254c9600ecbe01e9fb49f198039c5da82a87ea5b90e","src/iter_index.rs":"1b0ff8376a4ad855d44db8c662450c777db84e0f4997b53ca575c65b107bb83b","src/k_smallest.rs":"a6840980e4c1aedd6987f93c904d362aa09a101537e447121fff58bb2473638d","src/kmerge_impl.rs":"3f999d55d7def904f71f2ca88b36707461f7f23b32966e0ccaf31d808886d843","src/lazy_buffer.rs":"baa01490fceb5a8dd7bd9c2634e19ce8a785bd1df352a9dd77d1344e3e0f8892","src/lib.rs":"e7f144351cca5018dc12270b4c33f0562afddb92452acfa85153cb276aebd6e9","src/merge_join.rs":"f2f257e63c84ed772b235229cc787ebe9ae009d7c80ed2087002a6b62c5e2133","src/minmax.rs":"0ec34b172ca8efc4aacb96f3e5771bdc5e8ac882876ee0f59d698c3924717c48","src/multipeek_impl.rs":"79eef0be49ad66f15d41808e72c03976c4f7cff5838b69d17975d3ece266f3f8","src/next_array.rs":"295924058891c08f9fe6313a1d9dd0042dcf60f0a514c6a6e009a1396d804fc9","src/pad_tail.rs":"e6bb5b086478600b0dbb8726cae8364bf83ab36d989ef467e1264eea43933b50","src/peek_nth.rs":"093f1a157b1c917f041af5244a5a46311affa2922126e36dc0ee2c501c79b58c","src/peeking_take_while.rs":"075ce13475c84e2cfdfaf1a7a0d0695332102c82a61914ed4c00a7d2634b1d34","src/permutations.rs":"b316084ee14e9e138d22f177367b3bfa24cb3e5e90ab20b9b00a9a23d653496f","src/powerset.rs":"7ab24fefc914b339dd92a6c8e639d0cad34479e09293b3346078856d6bc02d34","src/process_results_impl.rs":"6b5d82447eef4e87fef7b2a8e56b906ac7b000886a468ce421252f34ec86e371","src/put_back_n_impl.rs":"5a58d7a31c03029f0726e4d42de3be869580cf76b73c6d1ef70dd40c240b03a0","src/rciter_impl.rs":"081fd206ba4a601bd65e2f3b8d7c95e3e4a3564beb7c98944bd2e7986959c230","src/repeatn.rs":"dd9a5bf5a63ef9cc6ec5c8a6137c7ffba80f13568b6d001e189daaa29ffbaf39","src/size_hint.rs":"6022c2327ddc6df7e7b939eb60a93ee66ea9aa4d3aab49b9952e663ff4bff10b","src/sources.rs":"ef942af209ca1effcd28a95abedad8c45b659ae2a15b66c2158cb604f6e325f8","src/take_while_inclusive.rs":"1973a9f5322b3dae3b5ccded5912a08a8e2e975b9a5eac666192b118b230d305","src/tee.rs":"dad50ca162627cf0a67786f0993ef27d06cdefc14d412463e58c07824ef409d8","src/tuple_impl.rs":"0213261109e7c65746ccc22425d19141907bf7ea1e3dd4c40e9f278e6148e272","src/unique_impl.rs":"1efc280226f13ddd7dd5f7eedeec0093b704596652c942f3a0b2f8c90fa2e2f7","src/unziptuple.rs":"f3f6a2ee2658fa07db7592f2c344c2e3b1263a21fc75e1325f2be32c9dc1e750","src/with_position.rs":"9ca1eb195d04690b0c3a62a6c0eea349b8042e11c4ca4b80744f54103e1c7355","src/zip_eq_impl.rs":"3282b177e7dece5d3fbdc9b03563f209589a399ea45e70abf23ccca3b5512ac7","src/zip_longest.rs":"5572699564dd5717cc074b7733333ed238c2e9f3e6819d45e33e3a2dbda74478","src/ziptuple.rs":"d3a12221d39c8a5514574adb3ad2ccd1803d514b1cb09fbcd9253e3ddd628310","tests/adaptors_no_collect.rs":"7e6240878b1fc13b6384fdde0317d5d7ccca3e417b10a201ba61eb5255400fda","tests/flatten_ok.rs":"b7894874132918b8229c7150b2637511d8e3e14197d8eeb9382d46b2a514efa2","tests/laziness.rs":"89e6caec10da3d7aeadf9e30d5caf03cda36d07cee8415ff134b5b8e2a2cf144","tests/macros_hygiene.rs":"c2d517badf593c0ba9b70e987a6f8482ed8997547b2e88bbec70babd9b677aa2","tests/merge_join.rs":"5fb506b989f4a331d46cdec5775ea594656985134196099eaf8d3905bdddcdd5","tests/peeking_take_while.rs":"f834361c5520dda15eb9e9ebe87507c905462201412b21859d9f83dab91d0e0b","tests/quick.rs":"d463bf8712b32742c93bc2cf3993031aeaba1f5b0505ca0ecd347313c3da0582","tests/specializations.rs":"fefbdac83bb774186882e3d31be619c9ce1dbfc4191a99ed2ac90aa764737a8f","tests/test_core.rs":"9bbc6772e97a60d93d4021c184b9e4de1c0440a1c48b991a92edc189699fd20d","tests/test_std.rs":"b0e56deefe309b9c11804bd069c744b5caea7960cd4b68244531f6edf38b9741","tests/tuples.rs":"014e4da776174bfe923270e2a359cd9c95b372fce4b952b8138909d6e2c52762","tests/zip.rs":"457e34761d9bf2943a43abd9020d2b1a4492ebff9e4d94efe4c730652fbf62af"},"package":"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"}
\ No newline at end of file
diff --git a/crates/itertools/Android.bp b/crates/itertools/Android.bp
index 18776c3..9e1cffa 100644
--- a/crates/itertools/Android.bp
+++ b/crates/itertools/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "itertools",
cargo_env_compat: true,
- cargo_pkg_version: "0.13.0",
+ cargo_pkg_version: "0.14.0",
crate_root: "src/lib.rs",
edition: "2018",
features: [
diff --git a/crates/itertools/CHANGELOG.md b/crates/itertools/CHANGELOG.md
index de9564c..6b08f68 100644
--- a/crates/itertools/CHANGELOG.md
+++ b/crates/itertools/CHANGELOG.md
@@ -1,5 +1,36 @@
# Changelog
+## 0.14.0
+
+### Breaking
+- Increased MSRV to 1.63.0 (#960)
+- Removed generic parameter from `cons_tuples` (#988)
+
+### Added
+- Added `array_combinations` (#991)
+- Added `k_smallest_relaxed` and variants (#925)
+- Added `next_array` and `collect_array` (#560)
+- Implemented `DoubleEndedIterator` for `FilterOk` (#948)
+- Implemented `DoubleEndedIterator` for `FilterMapOk` (#950)
+
+### Changed
+- Allow `Q: ?Sized` in `Itertools::contains` (#971)
+- Improved hygiene of `chain!` (#943)
+- Improved `into_group_map_by` documentation (#1000)
+- Improved `tree_reduce` documentation (#955)
+- Improved discoverability of `merge_join_by` (#966)
+- Improved discoverability of `take_while_inclusive` (#972)
+- Improved documentation of `find_or_last` and `find_or_first` (#984)
+- Prevented exponentially large type sizes in `tuple_combinations` (#945)
+- Added `track_caller` attr for `asser_equal` (#976)
+
+### Notable Internal Changes
+- Fixed clippy lints (#956, #987, #1008)
+- Addressed warnings within doctests (#964)
+- CI: Run most tests with miri (#961)
+- CI: Speed up "cargo-semver-checks" action (#938)
+- Changed an instance of `default_features` in `Cargo.toml` to `default-features` (#985)
+
## 0.13.0
### Breaking
diff --git a/crates/itertools/Cargo.lock b/crates/itertools/Cargo.lock
index d2183c2..fbf369b 100644
--- a/crates/itertools/Cargo.lock
+++ b/crates/itertools/Cargo.lock
@@ -236,7 +236,7 @@
[[package]]
name = "itertools"
-version = "0.13.0"
+version = "0.14.0"
dependencies = [
"criterion",
"either",
diff --git a/crates/itertools/Cargo.toml b/crates/itertools/Cargo.toml
index 21896fe..96f9597 100644
--- a/crates/itertools/Cargo.toml
+++ b/crates/itertools/Cargo.toml
@@ -11,10 +11,16 @@
[package]
edition = "2018"
-rust-version = "1.43.1"
+rust-version = "1.63.0"
name = "itertools"
-version = "0.13.0"
+version = "0.14.0"
authors = ["bluss"]
+build = false
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = "Extra iterator adaptors, iterator methods, free functions, and macros."
documentation = "https://docs.rs/itertools/"
readme = "README.md"
@@ -33,47 +39,120 @@
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-itertools/itertools"
-[profile.bench]
-debug = 2
+[features]
+default = ["use_std"]
+use_alloc = []
+use_std = [
+ "use_alloc",
+ "either/use_std",
+]
[lib]
+name = "itertools"
+path = "src/lib.rs"
test = false
bench = false
-[[bench]]
-name = "tuple_combinations"
-harness = false
+[[example]]
+name = "iris"
+path = "examples/iris.rs"
-[[bench]]
+[[test]]
+name = "adaptors_no_collect"
+path = "tests/adaptors_no_collect.rs"
+
+[[test]]
+name = "flatten_ok"
+path = "tests/flatten_ok.rs"
+
+[[test]]
+name = "laziness"
+path = "tests/laziness.rs"
+
+[[test]]
+name = "macros_hygiene"
+path = "tests/macros_hygiene.rs"
+
+[[test]]
+name = "merge_join"
+path = "tests/merge_join.rs"
+
+[[test]]
+name = "peeking_take_while"
+path = "tests/peeking_take_while.rs"
+
+[[test]]
+name = "quick"
+path = "tests/quick.rs"
+
+[[test]]
+name = "specializations"
+path = "tests/specializations.rs"
+
+[[test]]
+name = "test_core"
+path = "tests/test_core.rs"
+
+[[test]]
+name = "test_std"
+path = "tests/test_std.rs"
+
+[[test]]
name = "tuples"
-harness = false
+path = "tests/tuples.rs"
-[[bench]]
-name = "fold_specialization"
-harness = false
-
-[[bench]]
-name = "combinations_with_replacement"
-harness = false
-
-[[bench]]
-name = "tree_reduce"
-harness = false
+[[test]]
+name = "zip"
+path = "tests/zip.rs"
[[bench]]
name = "bench1"
+path = "benches/bench1.rs"
harness = false
[[bench]]
name = "combinations"
+path = "benches/combinations.rs"
+harness = false
+
+[[bench]]
+name = "combinations_with_replacement"
+path = "benches/combinations_with_replacement.rs"
+harness = false
+
+[[bench]]
+name = "fold_specialization"
+path = "benches/fold_specialization.rs"
+harness = false
+
+[[bench]]
+name = "k_smallest"
+path = "benches/k_smallest.rs"
harness = false
[[bench]]
name = "powerset"
+path = "benches/powerset.rs"
harness = false
[[bench]]
name = "specializations"
+path = "benches/specializations.rs"
+harness = false
+
+[[bench]]
+name = "tree_reduce"
+path = "benches/tree_reduce.rs"
+harness = false
+
+[[bench]]
+name = "tuple_combinations"
+path = "benches/tuple_combinations.rs"
+harness = false
+
+[[bench]]
+name = "tuples"
+path = "benches/tuples.rs"
harness = false
[dependencies.either]
@@ -82,6 +161,7 @@
[dev-dependencies.criterion]
version = "0.4.0"
+features = ["html_reports"]
[dev-dependencies.paste]
version = "1.0.0"
@@ -91,15 +171,10 @@
[dev-dependencies.quickcheck]
version = "0.9"
-default_features = false
+default-features = false
[dev-dependencies.rand]
version = "0.7"
-[features]
-default = ["use_std"]
-use_alloc = []
-use_std = [
- "use_alloc",
- "either/use_std",
-]
+[profile.bench]
+debug = 2
diff --git a/crates/itertools/METADATA b/crates/itertools/METADATA
index 6bb1771..775971a 100644
--- a/crates/itertools/METADATA
+++ b/crates/itertools/METADATA
@@ -1,17 +1,17 @@
name: "itertools"
description: "Extra iterator adaptors, iterator methods, free functions, and macros."
third_party {
- version: "0.13.0"
+ version: "0.14.0"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 9
- day: 4
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/itertools"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/itertools/itertools-0.13.0.crate"
- version: "0.13.0"
+ value: "https://static.crates.io/crates/itertools/itertools-0.14.0.crate"
+ version: "0.14.0"
}
}
diff --git a/crates/itertools/README.md b/crates/itertools/README.md
index 982ef5d..46acc3f 100644
--- a/crates/itertools/README.md
+++ b/crates/itertools/README.md
@@ -8,7 +8,7 @@
```toml
[dependencies]
-itertools = "0.13.0"
+itertools = "0.14.0"
```
How to use in your crate:
diff --git a/crates/itertools/benches/k_smallest.rs b/crates/itertools/benches/k_smallest.rs
new file mode 100644
index 0000000..509ed7f
--- /dev/null
+++ b/crates/itertools/benches/k_smallest.rs
@@ -0,0 +1,61 @@
+use criterion::{black_box, criterion_group, criterion_main, Bencher, BenchmarkId, Criterion};
+use itertools::Itertools;
+use rand::{rngs::StdRng, seq::SliceRandom, SeedableRng};
+
+fn strict(b: &mut Bencher, (k, vals): &(usize, &Vec<usize>)) {
+ b.iter(|| black_box(vals.iter()).k_smallest(*k))
+}
+
+fn relaxed(b: &mut Bencher, (k, vals): &(usize, &Vec<usize>)) {
+ b.iter(|| black_box(vals.iter()).k_smallest_relaxed(*k))
+}
+
+fn ascending(n: usize) -> Vec<usize> {
+ (0..n).collect()
+}
+
+fn random(n: usize) -> Vec<usize> {
+ let mut vals = (0..n).collect_vec();
+ vals.shuffle(&mut StdRng::seed_from_u64(42));
+ vals
+}
+
+fn descending(n: usize) -> Vec<usize> {
+ (0..n).rev().collect()
+}
+
+fn k_smallest(c: &mut Criterion, order: &str, vals: fn(usize) -> Vec<usize>) {
+ let mut g = c.benchmark_group(format!("k-smallest/{order}"));
+
+ for log_n in 20..23 {
+ let n = 1 << log_n;
+
+ let vals = vals(n);
+
+ for log_k in 7..10 {
+ let k = 1 << log_k;
+
+ let params = format!("{log_n}/{log_k}");
+ let input = (k, &vals);
+ g.bench_with_input(BenchmarkId::new("strict", ¶ms), &input, strict);
+ g.bench_with_input(BenchmarkId::new("relaxed", ¶ms), &input, relaxed);
+ }
+ }
+
+ g.finish()
+}
+
+fn k_smallest_asc(c: &mut Criterion) {
+ k_smallest(c, "asc", ascending);
+}
+
+fn k_smallest_rand(c: &mut Criterion) {
+ k_smallest(c, "rand", random);
+}
+
+fn k_smallest_desc(c: &mut Criterion) {
+ k_smallest(c, "desc", descending);
+}
+
+criterion_group!(benches, k_smallest_asc, k_smallest_rand, k_smallest_desc);
+criterion_main!(benches);
diff --git a/crates/itertools/benches/specializations.rs b/crates/itertools/benches/specializations.rs
index 18039fc..e70323f 100644
--- a/crates/itertools/benches/specializations.rs
+++ b/crates/itertools/benches/specializations.rs
@@ -1,4 +1,4 @@
-#![allow(unstable_name_collisions, clippy::incompatible_msrv)]
+#![allow(unstable_name_collisions)]
use criterion::black_box;
use criterion::BenchmarkId;
@@ -639,6 +639,7 @@
v.iter().copied().map_ok(|x| x + 1)
}
filter_ok {
+ DoubleEndedIterator
{
let v = black_box((0_u32..1024)
.map(|x| if x % 2 == 1 { Err(x) } else { Ok(x) })
@@ -647,6 +648,7 @@
v.iter().copied().filter_ok(|x| x % 3 == 0)
}
filter_map_ok {
+ DoubleEndedIterator
{
let v = black_box((0_u32..1024)
.map(|x| if x % 2 == 1 { Err(x) } else { Ok(x) })
diff --git a/crates/itertools/src/adaptors/mod.rs b/crates/itertools/src/adaptors/mod.rs
index 52e36c4..77192f2 100644
--- a/crates/itertools/src/adaptors/mod.rs
+++ b/crates/itertools/src/adaptors/mod.rs
@@ -515,7 +515,7 @@
f: F,
}
-impl<'a, I, F> fmt::Debug for TakeWhileRef<'a, I, F>
+impl<I, F> fmt::Debug for TakeWhileRef<'_, I, F>
where
I: Iterator + fmt::Debug,
{
@@ -530,7 +530,7 @@
TakeWhileRef { iter, f }
}
-impl<'a, I, F> Iterator for TakeWhileRef<'a, I, F>
+impl<I, F> Iterator for TakeWhileRef<'_, I, F>
where
I: Iterator + Clone,
F: FnMut(&I::Item) -> bool,
@@ -773,16 +773,28 @@
where
F: FnMut(B, Self::Item) -> B,
{
+ // We outline this closure to prevent it from unnecessarily
+ // capturing the type parameters `I`, `B`, and `F`. Not doing
+ // so ended up causing exponentially big types during MIR
+ // inlining when building itertools with optimizations enabled.
+ //
+ // This change causes a small improvement to compile times in
+ // release mode.
+ type CurrTuple<A> = (A, $(ignore_ident!($X, A)),*);
+ type PrevTuple<A> = ($(ignore_ident!($X, A),)*);
+ fn map_fn<A: Clone>(z: &A) -> impl FnMut(PrevTuple<A>) -> CurrTuple<A> + '_ {
+ move |($($X,)*)| (z.clone(), $($X),*)
+ }
let Self { c, item, mut iter } = self;
if let Some(z) = item.as_ref() {
init = c
- .map(|($($X,)*)| (z.clone(), $($X),*))
+ .map(map_fn::<A>(z))
.fold(init, &mut f);
}
while let Some(z) = iter.next() {
let c: $P<I> = iter.clone().into();
init = c
- .map(|($($X,)*)| (z.clone(), $($X),*))
+ .map(map_fn::<A>(&z))
.fold(init, &mut f);
}
init
@@ -924,6 +936,30 @@
}
}
+impl<I, F, T, E> DoubleEndedIterator for FilterOk<I, F>
+where
+ I: DoubleEndedIterator<Item = Result<T, E>>,
+ F: FnMut(&T) -> bool,
+{
+ fn next_back(&mut self) -> Option<Self::Item> {
+ let f = &mut self.f;
+ self.iter.rfind(|res| match res {
+ Ok(t) => f(t),
+ _ => true,
+ })
+ }
+
+ fn rfold<Acc, Fold>(self, init: Acc, fold_f: Fold) -> Acc
+ where
+ Fold: FnMut(Acc, Self::Item) -> Acc,
+ {
+ let mut f = self.f;
+ self.iter
+ .filter(|v| v.as_ref().map(&mut f).unwrap_or(true))
+ .rfold(init, fold_f)
+ }
+}
+
impl<I, F, T, E> FusedIterator for FilterOk<I, F>
where
I: FusedIterator<Item = Result<T, E>>,
@@ -1005,6 +1041,30 @@
}
}
+impl<I, F, T, U, E> DoubleEndedIterator for FilterMapOk<I, F>
+where
+ I: DoubleEndedIterator<Item = Result<T, E>>,
+ F: FnMut(T) -> Option<U>,
+{
+ fn next_back(&mut self) -> Option<Self::Item> {
+ let f = &mut self.f;
+ self.iter.by_ref().rev().find_map(|res| match res {
+ Ok(t) => f(t).map(Ok),
+ Err(e) => Some(Err(e)),
+ })
+ }
+
+ fn rfold<Acc, Fold>(self, init: Acc, fold_f: Fold) -> Acc
+ where
+ Fold: FnMut(Acc, Self::Item) -> Acc,
+ {
+ let mut f = self.f;
+ self.iter
+ .filter_map(|v| transpose_result(v.map(&mut f)))
+ .rfold(init, fold_f)
+ }
+}
+
impl<I, F, T, U, E> FusedIterator for FilterMapOk<I, F>
where
I: FusedIterator<Item = Result<T, E>>,
@@ -1048,9 +1108,7 @@
fn next(&mut self) -> Option<Self::Item> {
let f = &mut self.f;
- // TODO: once MSRV >= 1.62, use `then_some`.
- self.iter
- .find_map(|(count, val)| if f(val) { Some(count) } else { None })
+ self.iter.find_map(|(count, val)| f(val).then_some(count))
}
fn size_hint(&self) -> (usize, Option<usize>) {
@@ -1078,11 +1136,10 @@
{
fn next_back(&mut self) -> Option<Self::Item> {
let f = &mut self.f;
- // TODO: once MSRV >= 1.62, use `then_some`.
self.iter
.by_ref()
.rev()
- .find_map(|(count, val)| if f(val) { Some(count) } else { None })
+ .find_map(|(count, val)| f(val).then_some(count))
}
fn rfold<B, G>(self, init: B, mut func: G) -> B
diff --git a/crates/itertools/src/combinations.rs b/crates/itertools/src/combinations.rs
index 6bb2f3e..54a0275 100644
--- a/crates/itertools/src/combinations.rs
+++ b/crates/itertools/src/combinations.rs
@@ -1,3 +1,5 @@
+use core::array;
+use core::borrow::BorrowMut;
use std::fmt;
use std::iter::FusedIterator;
@@ -6,45 +8,101 @@
use crate::adaptors::checked_binomial;
+/// Iterator for `Vec` valued combinations returned by [`.combinations()`](crate::Itertools::combinations)
+pub type Combinations<I> = CombinationsGeneric<I, Vec<usize>>;
+/// Iterator for const generic combinations returned by [`.array_combinations()`](crate::Itertools::array_combinations)
+pub type ArrayCombinations<I, const K: usize> = CombinationsGeneric<I, [usize; K]>;
+
+/// Create a new `Combinations` from a clonable iterator.
+pub fn combinations<I: Iterator>(iter: I, k: usize) -> Combinations<I>
+where
+ I::Item: Clone,
+{
+ Combinations::new(iter, (0..k).collect())
+}
+
+/// Create a new `ArrayCombinations` from a clonable iterator.
+pub fn array_combinations<I: Iterator, const K: usize>(iter: I) -> ArrayCombinations<I, K>
+where
+ I::Item: Clone,
+{
+ ArrayCombinations::new(iter, array::from_fn(|i| i))
+}
+
/// An iterator to iterate through all the `k`-length combinations in an iterator.
///
-/// See [`.combinations()`](crate::Itertools::combinations) for more information.
+/// See [`.combinations()`](crate::Itertools::combinations) and [`.array_combinations()`](crate::Itertools::array_combinations) for more information.
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
-pub struct Combinations<I: Iterator> {
- indices: Vec<usize>,
+pub struct CombinationsGeneric<I: Iterator, Idx> {
+ indices: Idx,
pool: LazyBuffer<I>,
first: bool,
}
-impl<I> Clone for Combinations<I>
+/// A type holding indices of elements in a pool or buffer of items from an inner iterator
+/// and used to pick out different combinations in a generic way.
+pub trait PoolIndex<T>: BorrowMut<[usize]> {
+ type Item;
+
+ fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> Self::Item
+ where
+ T: Clone;
+
+ fn len(&self) -> usize {
+ self.borrow().len()
+ }
+}
+
+impl<T> PoolIndex<T> for Vec<usize> {
+ type Item = Vec<T>;
+
+ fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> Vec<T>
+ where
+ T: Clone,
+ {
+ pool.get_at(self)
+ }
+}
+
+impl<T, const K: usize> PoolIndex<T> for [usize; K] {
+ type Item = [T; K];
+
+ fn extract_item<I: Iterator<Item = T>>(&self, pool: &LazyBuffer<I>) -> [T; K]
+ where
+ T: Clone,
+ {
+ pool.get_array(*self)
+ }
+}
+
+impl<I, Idx> Clone for CombinationsGeneric<I, Idx>
where
- I: Clone + Iterator,
+ I: Iterator + Clone,
I::Item: Clone,
+ Idx: Clone,
{
clone_fields!(indices, pool, first);
}
-impl<I> fmt::Debug for Combinations<I>
+impl<I, Idx> fmt::Debug for CombinationsGeneric<I, Idx>
where
I: Iterator + fmt::Debug,
I::Item: fmt::Debug,
+ Idx: fmt::Debug,
{
debug_fmt_fields!(Combinations, indices, pool, first);
}
-/// Create a new `Combinations` from a clonable iterator.
-pub fn combinations<I>(iter: I, k: usize) -> Combinations<I>
-where
- I: Iterator,
-{
- Combinations {
- indices: (0..k).collect(),
- pool: LazyBuffer::new(iter),
- first: true,
+impl<I: Iterator, Idx: PoolIndex<I::Item>> CombinationsGeneric<I, Idx> {
+ /// Constructor with arguments the inner iterator and the initial state for the indices.
+ fn new(iter: I, indices: Idx) -> Self {
+ Self {
+ indices,
+ pool: LazyBuffer::new(iter),
+ first: true,
+ }
}
-}
-impl<I: Iterator> Combinations<I> {
/// Returns the length of a combination produced by this iterator.
#[inline]
pub fn k(&self) -> usize {
@@ -64,27 +122,7 @@
&self.pool
}
- /// Resets this `Combinations` back to an initial state for combinations of length
- /// `k` over the same pool data source. If `k` is larger than the current length
- /// of the data pool an attempt is made to prefill the pool so that it holds `k`
- /// elements.
- pub(crate) fn reset(&mut self, k: usize) {
- self.first = true;
-
- if k < self.indices.len() {
- self.indices.truncate(k);
- for i in 0..k {
- self.indices[i] = i;
- }
- } else {
- for i in 0..self.indices.len() {
- self.indices[i] = i;
- }
- self.indices.extend(self.indices.len()..k);
- self.pool.prefill(k);
- }
- }
-
+ /// Return the length of the inner iterator and the count of remaining combinations.
pub(crate) fn n_and_count(self) -> (usize, usize) {
let Self {
indices,
@@ -92,7 +130,7 @@
first,
} = self;
let n = pool.count();
- (n, remaining_for(n, first, &indices).unwrap())
+ (n, remaining_for(n, first, indices.borrow()).unwrap())
}
/// Initialises the iterator by filling a buffer with elements from the
@@ -113,19 +151,21 @@
///
/// Returns true if we've run out of combinations, false otherwise.
fn increment_indices(&mut self) -> bool {
- if self.indices.is_empty() {
+ // Borrow once instead of noise each time it's indexed
+ let indices = self.indices.borrow_mut();
+
+ if indices.is_empty() {
return true; // Done
}
-
// Scan from the end, looking for an index to increment
- let mut i: usize = self.indices.len() - 1;
+ let mut i: usize = indices.len() - 1;
// Check if we need to consume more from the iterator
- if self.indices[i] == self.pool.len() - 1 {
+ if indices[i] == self.pool.len() - 1 {
self.pool.get_next(); // may change pool size
}
- while self.indices[i] == i + self.pool.len() - self.indices.len() {
+ while indices[i] == i + self.pool.len() - indices.len() {
if i > 0 {
i -= 1;
} else {
@@ -135,11 +175,10 @@
}
// Increment index, and reset the ones to its right
- self.indices[i] += 1;
- for j in i + 1..self.indices.len() {
- self.indices[j] = self.indices[j - 1] + 1;
+ indices[i] += 1;
+ for j in i + 1..indices.len() {
+ indices[j] = indices[j - 1] + 1;
}
-
// If we've made it this far, we haven't run out of combos
false
}
@@ -147,6 +186,7 @@
/// Returns the n-th item or the number of successful steps.
pub(crate) fn try_nth(&mut self, n: usize) -> Result<<Self as Iterator>::Item, usize>
where
+ I: Iterator,
I::Item: Clone,
{
let done = if self.first {
@@ -162,16 +202,17 @@
return Err(i + 1);
}
}
- Ok(self.pool.get_at(&self.indices))
+ Ok(self.indices.extract_item(&self.pool))
}
}
-impl<I> Iterator for Combinations<I>
+impl<I, Idx> Iterator for CombinationsGeneric<I, Idx>
where
I: Iterator,
I::Item: Clone,
+ Idx: PoolIndex<I::Item>,
{
- type Item = Vec<I::Item>;
+ type Item = Idx::Item;
fn next(&mut self) -> Option<Self::Item> {
let done = if self.first {
self.init()
@@ -183,7 +224,7 @@
return None;
}
- Some(self.pool.get_at(&self.indices))
+ Some(self.indices.extract_item(&self.pool))
}
fn nth(&mut self, n: usize) -> Option<Self::Item> {
@@ -192,8 +233,8 @@
fn size_hint(&self) -> (usize, Option<usize>) {
let (mut low, mut upp) = self.pool.size_hint();
- low = remaining_for(low, self.first, &self.indices).unwrap_or(usize::MAX);
- upp = upp.and_then(|upp| remaining_for(upp, self.first, &self.indices));
+ low = remaining_for(low, self.first, self.indices.borrow()).unwrap_or(usize::MAX);
+ upp = upp.and_then(|upp| remaining_for(upp, self.first, self.indices.borrow()));
(low, upp)
}
@@ -203,13 +244,37 @@
}
}
-impl<I> FusedIterator for Combinations<I>
+impl<I, Idx> FusedIterator for CombinationsGeneric<I, Idx>
where
I: Iterator,
I::Item: Clone,
+ Idx: PoolIndex<I::Item>,
{
}
+impl<I: Iterator> Combinations<I> {
+ /// Resets this `Combinations` back to an initial state for combinations of length
+ /// `k` over the same pool data source. If `k` is larger than the current length
+ /// of the data pool an attempt is made to prefill the pool so that it holds `k`
+ /// elements.
+ pub(crate) fn reset(&mut self, k: usize) {
+ self.first = true;
+
+ if k < self.indices.len() {
+ self.indices.truncate(k);
+ for i in 0..k {
+ self.indices[i] = i;
+ }
+ } else {
+ for i in 0..self.indices.len() {
+ self.indices[i] = i;
+ }
+ self.indices.extend(self.indices.len()..k);
+ self.pool.prefill(k);
+ }
+ }
+}
+
/// For a given size `n`, return the count of remaining combinations or None if it would overflow.
fn remaining_for(n: usize, first: bool, indices: &[usize]) -> Option<usize> {
let k = indices.len();
diff --git a/crates/itertools/src/combinations_with_replacement.rs b/crates/itertools/src/combinations_with_replacement.rs
index f363f9b..c17e752 100644
--- a/crates/itertools/src/combinations_with_replacement.rs
+++ b/crates/itertools/src/combinations_with_replacement.rs
@@ -73,11 +73,7 @@
Some((increment_from, increment_value)) => {
// We need to update the rightmost non-max value
// and all those to the right
- for i in &mut self.indices[increment_from..] {
- *i = increment_value;
- }
- // TODO: once MSRV >= 1.50, use `fill` instead:
- // self.indices[increment_from..].fill(increment_value);
+ self.indices[increment_from..].fill(increment_value);
false
}
// Otherwise, we're done
diff --git a/crates/itertools/src/concat_impl.rs b/crates/itertools/src/concat_impl.rs
index ec7b91c..dc80839 100644
--- a/crates/itertools/src/concat_impl.rs
+++ b/crates/itertools/src/concat_impl.rs
@@ -1,8 +1,6 @@
-use crate::Itertools;
-
/// Combine all an iterator's elements into one element by using [`Extend`].
///
-/// [`IntoIterator`]-enabled version of [`Itertools::concat`].
+/// [`IntoIterator`]-enabled version of [`Itertools::concat`](crate::Itertools::concat).
///
/// This combinator will extend the first item with each of the rest of the
/// items of the iterator. If the iterator is empty, the default value of
@@ -19,10 +17,9 @@
I: IntoIterator,
I::Item: Extend<<<I as IntoIterator>::Item as IntoIterator>::Item> + IntoIterator + Default,
{
- #[allow(deprecated)] //TODO: once msrv hits 1.51. replace `fold1` with `reduce`
iterable
.into_iter()
- .fold1(|mut a, b| {
+ .reduce(|mut a, b| {
a.extend(b);
a
})
diff --git a/crates/itertools/src/cons_tuples_impl.rs b/crates/itertools/src/cons_tuples_impl.rs
index 9ab3094..7e86260 100644
--- a/crates/itertools/src/cons_tuples_impl.rs
+++ b/crates/itertools/src/cons_tuples_impl.rs
@@ -1,24 +1,15 @@
+use crate::adaptors::map::{MapSpecialCase, MapSpecialCaseFn};
+
macro_rules! impl_cons_iter(
($_A:ident, $_B:ident, ) => (); // stop
($A:ident, $($B:ident,)*) => (
impl_cons_iter!($($B,)*);
#[allow(non_snake_case)]
- impl<X, Iter, $($B),*> Iterator for ConsTuples<Iter, (($($B,)*), X)>
- where Iter: Iterator<Item = (($($B,)*), X)>,
- {
- type Item = ($($B,)* X, );
- fn next(&mut self) -> Option<Self::Item> {
- self.iter.next().map(|(($($B,)*), x)| ($($B,)* x, ))
- }
-
- fn size_hint(&self) -> (usize, Option<usize>) {
- self.iter.size_hint()
- }
- fn fold<Acc, Fold>(self, accum: Acc, mut f: Fold) -> Acc
- where Fold: FnMut(Acc, Self::Item) -> Acc,
- {
- self.iter.fold(accum, move |acc, (($($B,)*), x)| f(acc, ($($B,)* x, )))
+ impl<$($B),*, X> MapSpecialCaseFn<(($($B,)*), X)> for ConsTuplesFn {
+ type Out = ($($B,)* X, );
+ fn call(&mut self, (($($B,)*), X): (($($B,)*), X)) -> Self::Out {
+ ($($B,)* X, )
}
}
);
@@ -26,33 +17,23 @@
impl_cons_iter!(A, B, C, D, E, F, G, H, I, J, K, L,);
+#[derive(Debug, Clone)]
+pub struct ConsTuplesFn;
+
/// An iterator that maps an iterator of tuples like
/// `((A, B), C)` to an iterator of `(A, B, C)`.
///
/// Used by the `iproduct!()` macro.
-#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
-#[derive(Debug)]
-pub struct ConsTuples<I, J>
-where
- I: Iterator<Item = J>,
-{
- iter: I,
-}
-
-impl<I, J> Clone for ConsTuples<I, J>
-where
- I: Clone + Iterator<Item = J>,
-{
- clone_fields!(iter);
-}
+pub type ConsTuples<I> = MapSpecialCase<I, ConsTuplesFn>;
/// Create an iterator that maps for example iterators of
/// `((A, B), C)` to `(A, B, C)`.
-pub fn cons_tuples<I, J>(iterable: I) -> ConsTuples<I::IntoIter, J>
+pub fn cons_tuples<I>(iterable: I) -> ConsTuples<I::IntoIter>
where
- I: IntoIterator<Item = J>,
+ I: IntoIterator,
{
ConsTuples {
iter: iterable.into_iter(),
+ f: ConsTuplesFn,
}
}
diff --git a/crates/itertools/src/diff.rs b/crates/itertools/src/diff.rs
index c6d9965..df88d80 100644
--- a/crates/itertools/src/diff.rs
+++ b/crates/itertools/src/diff.rs
@@ -1,7 +1,7 @@
//! "Diff"ing iterators for caching elements to sequential collections without requiring the new
//! elements' iterator to be `Clone`.
//!
-//! - [`Diff`] (produced by the [`diff_with`] function)
+//! [`Diff`] (produced by the [`diff_with`] function)
//! describes the difference between two non-`Clone` iterators `I` and `J` after breaking ASAP from
//! a lock-step comparison.
diff --git a/crates/itertools/src/extrema_set.rs b/crates/itertools/src/extrema_set.rs
index d24114c..7d35382 100644
--- a/crates/itertools/src/extrema_set.rs
+++ b/crates/itertools/src/extrema_set.rs
@@ -1,4 +1,3 @@
-#![cfg(feature = "use_alloc")]
use alloc::{vec, vec::Vec};
use std::cmp::Ordering;
diff --git a/crates/itertools/src/format.rs b/crates/itertools/src/format.rs
index 15cee34..3abdda3 100644
--- a/crates/itertools/src/format.rs
+++ b/crates/itertools/src/format.rs
@@ -47,7 +47,7 @@
}
}
-impl<'a, I, F> fmt::Display for FormatWith<'a, I, F>
+impl<I, F> fmt::Display for FormatWith<'_, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
@@ -71,7 +71,7 @@
}
}
-impl<'a, I, F> fmt::Debug for FormatWith<'a, I, F>
+impl<I, F> fmt::Debug for FormatWith<'_, I, F>
where
I: Iterator,
F: FnMut(I::Item, &mut dyn FnMut(&dyn fmt::Display) -> fmt::Result) -> fmt::Result,
@@ -81,7 +81,7 @@
}
}
-impl<'a, I> Format<'a, I>
+impl<I> Format<'_, I>
where
I: Iterator,
{
@@ -125,7 +125,7 @@
impl_format! {Display Debug UpperExp LowerExp UpperHex LowerHex Octal Binary Pointer}
-impl<'a, I, F> Clone for FormatWith<'a, I, F>
+impl<I, F> Clone for FormatWith<'_, I, F>
where
(I, F): Clone,
{
@@ -135,7 +135,7 @@
inner: Option<(I, F)>,
}
// This ensures we preserve the state of the original `FormatWith` if `Clone` panics
- impl<'r, 'a, I, F> Drop for PutBackOnDrop<'r, 'a, I, F> {
+ impl<I, F> Drop for PutBackOnDrop<'_, '_, I, F> {
fn drop(&mut self) {
self.into.inner.set(self.inner.take())
}
@@ -151,7 +151,7 @@
}
}
-impl<'a, I> Clone for Format<'a, I>
+impl<I> Clone for Format<'_, I>
where
I: Clone,
{
@@ -161,7 +161,7 @@
inner: Option<I>,
}
// This ensures we preserve the state of the original `FormatWith` if `Clone` panics
- impl<'r, 'a, I> Drop for PutBackOnDrop<'r, 'a, I> {
+ impl<I> Drop for PutBackOnDrop<'_, '_, I> {
fn drop(&mut self) {
self.into.inner.set(self.inner.take())
}
diff --git a/crates/itertools/src/free.rs b/crates/itertools/src/free.rs
index 8d0bcf3..4c68205 100644
--- a/crates/itertools/src/free.rs
+++ b/crates/itertools/src/free.rs
@@ -36,7 +36,7 @@
/// ```
/// use itertools::intersperse;
///
-/// itertools::assert_equal(intersperse((0..3), 8), vec![0, 8, 1, 8, 2]);
+/// itertools::assert_equal(intersperse(0..3, 8), vec![0, 8, 1, 8, 2]);
/// ```
pub fn intersperse<I>(iterable: I, element: I::Item) -> Intersperse<I::IntoIter>
where
@@ -55,7 +55,7 @@
/// use itertools::intersperse_with;
///
/// let mut i = 10;
-/// itertools::assert_equal(intersperse_with((0..3), || { i -= 1; i }), vec![0, 9, 1, 8, 2]);
+/// itertools::assert_equal(intersperse_with(0..3, || { i -= 1; i }), vec![0, 9, 1, 8, 2]);
/// assert_eq!(i, 8);
/// ```
pub fn intersperse_with<I, F>(iterable: I, element: F) -> IntersperseWith<I::IntoIter, F>
@@ -75,6 +75,7 @@
///
/// for (i, elt) in enumerate(&[1, 2, 3]) {
/// /* loop body */
+/// # let _ = (i, elt);
/// }
/// ```
pub fn enumerate<I>(iterable: I) -> iter::Enumerate<I::IntoIter>
@@ -93,6 +94,7 @@
///
/// for elt in rev(&[1, 2, 3]) {
/// /* loop body */
+/// # let _ = elt;
/// }
/// ```
pub fn rev<I>(iterable: I) -> iter::Rev<I::IntoIter>
diff --git a/crates/itertools/src/grouping_map.rs b/crates/itertools/src/grouping_map.rs
index b4aae9e..86cb55d 100644
--- a/crates/itertools/src/grouping_map.rs
+++ b/crates/itertools/src/grouping_map.rs
@@ -1,5 +1,3 @@
-#![cfg(feature = "use_std")]
-
use crate::{
adaptors::map::{MapSpecialCase, MapSpecialCaseFn},
MinMaxResult,
diff --git a/crates/itertools/src/k_smallest.rs b/crates/itertools/src/k_smallest.rs
index 7b2f62e..7e4ace2 100644
--- a/crates/itertools/src/k_smallest.rs
+++ b/crates/itertools/src/k_smallest.rs
@@ -88,6 +88,46 @@
storage
}
+pub(crate) fn k_smallest_relaxed_general<I, F>(iter: I, k: usize, mut comparator: F) -> Vec<I::Item>
+where
+ I: Iterator,
+ F: FnMut(&I::Item, &I::Item) -> Ordering,
+{
+ if k == 0 {
+ iter.last();
+ return Vec::new();
+ }
+
+ let mut iter = iter.fuse();
+ let mut buf = iter.by_ref().take(2 * k).collect::<Vec<_>>();
+
+ if buf.len() < k {
+ buf.sort_unstable_by(&mut comparator);
+ return buf;
+ }
+
+ buf.select_nth_unstable_by(k - 1, &mut comparator);
+ buf.truncate(k);
+
+ iter.for_each(|val| {
+ if comparator(&val, &buf[k - 1]) != Ordering::Less {
+ return;
+ }
+
+ assert_ne!(buf.len(), buf.capacity());
+ buf.push(val);
+
+ if buf.len() == 2 * k {
+ buf.select_nth_unstable_by(k - 1, &mut comparator);
+ buf.truncate(k);
+ }
+ });
+
+ buf.sort_unstable_by(&mut comparator);
+ buf.truncate(k);
+ buf
+}
+
#[inline]
pub(crate) fn key_to_cmp<T, K, F>(mut key: F) -> impl FnMut(&T, &T) -> Ordering
where
diff --git a/crates/itertools/src/kmerge_impl.rs b/crates/itertools/src/kmerge_impl.rs
index 0be3840..9ea73f9 100644
--- a/crates/itertools/src/kmerge_impl.rs
+++ b/crates/itertools/src/kmerge_impl.rs
@@ -1,5 +1,4 @@
use crate::size_hint;
-use crate::Itertools;
use alloc::vec::Vec;
use std::fmt;
@@ -128,13 +127,14 @@
/// Create an iterator that merges elements of the contained iterators using
/// the ordering function.
///
-/// [`IntoIterator`] enabled version of [`Itertools::kmerge`].
+/// [`IntoIterator`] enabled version of [`Itertools::kmerge`](crate::Itertools::kmerge).
///
/// ```
/// use itertools::kmerge;
///
/// for elt in kmerge(vec![vec![0, 2, 4], vec![1, 3, 5], vec![6, 7]]) {
/// /* loop body */
+/// # let _ = elt;
/// }
/// ```
pub fn kmerge<I>(iterable: I) -> KMerge<<I::Item as IntoIterator>::IntoIter>
@@ -172,7 +172,7 @@
/// Create an iterator that merges elements of the contained iterators.
///
-/// [`IntoIterator`] enabled version of [`Itertools::kmerge_by`].
+/// [`IntoIterator`] enabled version of [`Itertools::kmerge_by`](crate::Itertools::kmerge_by).
pub fn kmerge_by<I, F>(
iterable: I,
mut less_than: F,
@@ -223,11 +223,10 @@
}
fn size_hint(&self) -> (usize, Option<usize>) {
- #[allow(deprecated)] //TODO: once msrv hits 1.51. replace `fold1` with `reduce`
self.heap
.iter()
.map(|i| i.size_hint())
- .fold1(size_hint::add)
+ .reduce(size_hint::add)
.unwrap_or((0, Some(0)))
}
}
diff --git a/crates/itertools/src/lazy_buffer.rs b/crates/itertools/src/lazy_buffer.rs
index fefcff8..fafa5f7 100644
--- a/crates/itertools/src/lazy_buffer.rs
+++ b/crates/itertools/src/lazy_buffer.rs
@@ -59,6 +59,10 @@
pub fn get_at(&self, indices: &[usize]) -> Vec<I::Item> {
indices.iter().map(|i| self.buffer[*i].clone()).collect()
}
+
+ pub fn get_array<const K: usize>(&self, indices: [usize; K]) -> [I::Item; K] {
+ indices.map(|i| self.buffer[i].clone())
+ }
}
impl<I, J> Index<J> for LazyBuffer<I>
diff --git a/crates/itertools/src/lib.rs b/crates/itertools/src/lib.rs
index f4de79c..20226d8 100644
--- a/crates/itertools/src/lib.rs
+++ b/crates/itertools/src/lib.rs
@@ -1,6 +1,7 @@
#![warn(missing_docs, clippy::default_numeric_fallback)]
#![crate_name = "itertools"]
#![cfg_attr(not(feature = "use_std"), no_std)]
+#![doc(test(attr(deny(warnings), allow(deprecated, unstable_name_collisions))))]
//! Extra iterator adaptors, functions and macros.
//!
@@ -8,6 +9,7 @@
//! the [`Itertools`] trait:
//!
//! ```
+//! # #[allow(unused_imports)]
//! use itertools::Itertools;
//! ```
//!
@@ -29,6 +31,7 @@
//!
//! for elt in interleave(&[1, 2, 3], &[2, 3, 4]) {
//! /* loop body */
+//! # let _ = elt;
//! }
//! ```
//!
@@ -46,7 +49,7 @@
//!
//! ## Rust Version
//!
-//! This version of itertools requires Rust 1.43.1 or later.
+//! This version of itertools requires Rust 1.63.0 or later.
#[cfg(not(feature = "use_std"))]
extern crate core as std;
@@ -94,7 +97,7 @@
TakeWhileRef, TupleCombinations, Update, WhileSome,
};
#[cfg(feature = "use_alloc")]
- pub use crate::combinations::Combinations;
+ pub use crate::combinations::{ArrayCombinations, Combinations};
#[cfg(feature = "use_alloc")]
pub use crate::combinations_with_replacement::CombinationsWithReplacement;
pub use crate::cons_tuples_impl::ConsTuples;
@@ -206,6 +209,7 @@
mod minmax;
#[cfg(feature = "use_alloc")]
mod multipeek_impl;
+mod next_array;
mod pad_tail;
#[cfg(feature = "use_alloc")]
mod peek_nth;
@@ -248,6 +252,7 @@
/// // from (0, 0, 0), (0, 0, 1), .., (0, 1, 0), (0, 1, 1), .. etc until (3, 3, 3)
/// for (i, j, k) in iproduct!(0..4, 0..4, 0..4) {
/// // ..
+/// # let _ = (i, j, k);
/// }
/// # }
/// ```
@@ -262,7 +267,10 @@
$crate::__std_iter::once(())
);
($I:expr $(,)?) => (
- $crate::__std_iter::IntoIterator::into_iter($I).map(|elt| (elt,))
+ $crate::__std_iter::Iterator::map(
+ $crate::__std_iter::IntoIterator::into_iter($I),
+ |elt| (elt,)
+ )
);
($I:expr, $J:expr $(,)?) => (
$crate::Itertools::cartesian_product(
@@ -330,19 +338,24 @@
// binary
($first:expr, $second:expr $(,)*) => {
- $crate::izip!($first)
- .zip($second)
+ $crate::__std_iter::Iterator::zip(
+ $crate::__std_iter::IntoIterator::into_iter($first),
+ $second,
+ )
};
// n-ary where n > 2
( $first:expr $( , $rest:expr )* $(,)* ) => {
- $crate::izip!($first)
+ {
+ let iter = $crate::__std_iter::IntoIterator::into_iter($first);
$(
- .zip($rest)
+ let iter = $crate::__std_iter::Iterator::zip(iter, $rest);
)*
- .map(
+ $crate::__std_iter::Iterator::map(
+ iter,
$crate::izip!(@closure a => (a) $( , $rest )*)
)
+ }
};
}
@@ -367,16 +380,16 @@
///
/// Invocations of `chain!` with one argument expand to [`arg.into_iter()`](IntoIterator):
/// ```
-/// use std::{ops::Range, slice};
+/// use std::ops::Range;
/// use itertools::chain;
-/// let _: <Range<_> as IntoIterator>::IntoIter = chain!((2..6),); // trailing comma optional!
+/// let _: <Range<_> as IntoIterator>::IntoIter = chain!(2..6,); // trailing comma optional!
/// let _: <&[_] as IntoIterator>::IntoIter = chain!(&[2, 3, 4]);
/// ```
///
/// Invocations of `chain!` with multiple arguments [`.into_iter()`](IntoIterator) each
/// argument, and then [`chain`] them together:
/// ```
-/// use std::{iter::*, ops::Range, slice};
+/// use std::{iter::*, slice};
/// use itertools::{assert_equal, chain};
///
/// // e.g., this:
@@ -393,16 +406,16 @@
/// ```
macro_rules! chain {
() => {
- core::iter::empty()
+ $crate::__std_iter::empty()
};
($first:expr $(, $rest:expr )* $(,)?) => {
{
- let iter = core::iter::IntoIterator::into_iter($first);
+ let iter = $crate::__std_iter::IntoIterator::into_iter($first);
$(
let iter =
- core::iter::Iterator::chain(
+ $crate::__std_iter::Iterator::chain(
iter,
- core::iter::IntoIterator::into_iter($rest));
+ $crate::__std_iter::IntoIterator::into_iter($rest));
)*
iter
}
@@ -415,13 +428,13 @@
/// This trait defines a number of methods. They are divided into two groups:
///
/// * *Adaptors* take an iterator and parameter as input, and return
-/// a new iterator value. These are listed first in the trait. An example
-/// of an adaptor is [`.interleave()`](Itertools::interleave)
+/// a new iterator value. These are listed first in the trait. An example
+/// of an adaptor is [`.interleave()`](Itertools::interleave)
///
/// * *Regular methods* are those that don't return iterators and instead
-/// return a regular value of some other kind.
-/// [`.next_tuple()`](Itertools::next_tuple) is an example and the first regular
-/// method in the list.
+/// return a regular value of some other kind.
+/// [`.next_tuple()`](Itertools::next_tuple) is an example and the first regular
+/// method in the list.
pub trait Itertools: Iterator {
// adaptors
@@ -1043,7 +1056,6 @@
/// let it = a.merge_by(b, |x, y| x.1 <= y.1);
/// itertools::assert_equal(it, vec![(0, 'a'), (0, 'b'), (1, 'c'), (1, 'd')]);
/// ```
-
fn merge_by<J, F>(self, other: J, is_first: F) -> MergeBy<Self, J::IntoIter, F>
where
Self: Sized,
@@ -1079,7 +1091,9 @@
/// let b = (0..10).step_by(3);
///
/// itertools::assert_equal(
- /// a.merge_join_by(b, |i, j| i.cmp(j)),
+ /// // This performs a diff in the style of the Unix command comm(1),
+ /// // generalized to arbitrary types rather than text.
+ /// a.merge_join_by(b, Ord::cmp),
/// vec![Both(0, 0), Left(2), Right(3), Left(4), Both(6, 6), Left(1), Right(9)]
/// );
/// ```
@@ -1111,6 +1125,7 @@
/// );
/// ```
#[inline]
+ #[doc(alias = "comm")]
fn merge_join_by<J, F, T>(self, other: J, cmp_fn: F) -> MergeJoinBy<Self, J::IntoIter, F>
where
J: IntoIterator,
@@ -1582,6 +1597,7 @@
/// .collect();
/// let expected: Vec<_> = vec![1, 2, 3].into_iter().map(NoCloneImpl).collect();
/// assert_eq!(filtered, expected);
+ #[doc(alias = "take_until")]
fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where
Self: Sized,
@@ -1658,6 +1674,53 @@
adaptors::tuple_combinations(self)
}
+ /// Return an iterator adaptor that iterates over the combinations of the
+ /// elements from an iterator.
+ ///
+ /// Iterator element type is [Self::Item; K]. The iterator produces a new
+ /// array per iteration, and clones the iterator elements.
+ ///
+ /// # Guarantees
+ ///
+ /// If the adapted iterator is deterministic,
+ /// this iterator adapter yields items in a reliable order.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// let mut v = Vec::new();
+ /// for [a, b] in (1..5).array_combinations() {
+ /// v.push([a, b]);
+ /// }
+ /// assert_eq!(v, vec![[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]);
+ ///
+ /// let mut it = (1..5).array_combinations();
+ /// assert_eq!(Some([1, 2, 3]), it.next());
+ /// assert_eq!(Some([1, 2, 4]), it.next());
+ /// assert_eq!(Some([1, 3, 4]), it.next());
+ /// assert_eq!(Some([2, 3, 4]), it.next());
+ /// assert_eq!(None, it.next());
+ ///
+ /// // this requires a type hint
+ /// let it = (1..5).array_combinations::<3>();
+ /// itertools::assert_equal(it, vec![[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]);
+ ///
+ /// // you can also specify the complete type
+ /// use itertools::ArrayCombinations;
+ /// use std::ops::Range;
+ ///
+ /// let it: ArrayCombinations<Range<u32>, 3> = (1..5).array_combinations();
+ /// itertools::assert_equal(it, vec![[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn array_combinations<const K: usize>(self) -> ArrayCombinations<Self, K>
+ where
+ Self: Sized + Clone,
+ Self::Item: Clone,
+ {
+ combinations::array_combinations(self)
+ }
+
/// Return an iterator adaptor that iterates over the `k`-length combinations of
/// the elements from an iterator.
///
@@ -1894,7 +1957,7 @@
/// use itertools::Itertools;
///
/// let input = vec![vec![1], vec![3, 2, 1]];
- /// let it = input.into_iter().update(|mut v| v.push(0));
+ /// let it = input.into_iter().update(|v| v.push(0));
/// itertools::assert_equal(it, vec![vec![1, 0], vec![3, 2, 1, 0]]);
/// ```
fn update<F>(self, updater: F) -> Update<Self, F>
@@ -1906,6 +1969,50 @@
}
// non-adaptor methods
+ /// Advances the iterator and returns the next items grouped in an array of
+ /// a specific size.
+ ///
+ /// If there are enough elements to be grouped in an array, then the array
+ /// is returned inside `Some`, otherwise `None` is returned.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// let mut iter = 1..5;
+ ///
+ /// assert_eq!(Some([1, 2]), iter.next_array());
+ /// ```
+ fn next_array<const N: usize>(&mut self) -> Option<[Self::Item; N]>
+ where
+ Self: Sized,
+ {
+ next_array::next_array(self)
+ }
+
+ /// Collects all items from the iterator into an array of a specific size.
+ ///
+ /// If the number of elements inside the iterator is **exactly** equal to
+ /// the array size, then the array is returned inside `Some`, otherwise
+ /// `None` is returned.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// let iter = 1..3;
+ ///
+ /// if let Some([x, y]) = iter.collect_array() {
+ /// assert_eq!([x, y], [1, 2])
+ /// } else {
+ /// panic!("Expected two elements")
+ /// }
+ /// ```
+ fn collect_array<const N: usize>(mut self) -> Option<[Self::Item; N]>
+ where
+ Self: Sized,
+ {
+ self.next_array().filter(|_| self.next().is_none())
+ }
+
/// Advances the iterator and returns the next items grouped in a tuple of
/// a specific size (up to 12).
///
@@ -1986,6 +2093,15 @@
/// assert_eq!(numbers.iter().find_or_last(|&&x| x > 5), Some(&4));
/// assert_eq!(numbers.iter().find_or_last(|&&x| x > 2), Some(&3));
/// assert_eq!(std::iter::empty::<i32>().find_or_last(|&x| x > 5), None);
+ ///
+ /// // An iterator of Results can return the first Ok or the last Err:
+ /// let input = vec![Err(()), Ok(11), Err(()), Ok(22)];
+ /// assert_eq!(input.into_iter().find_or_last(Result::is_ok), Some(Ok(11)));
+ ///
+ /// let input: Vec<Result<(), i32>> = vec![Err(11), Err(22)];
+ /// assert_eq!(input.into_iter().find_or_last(Result::is_ok), Some(Err(22)));
+ ///
+ /// assert_eq!(std::iter::empty::<Result<(), i32>>().find_or_last(Result::is_ok), None);
/// ```
fn find_or_last<P>(mut self, mut predicate: P) -> Option<Self::Item>
where
@@ -2014,6 +2130,15 @@
/// assert_eq!(numbers.iter().find_or_first(|&&x| x > 5), Some(&1));
/// assert_eq!(numbers.iter().find_or_first(|&&x| x > 2), Some(&3));
/// assert_eq!(std::iter::empty::<i32>().find_or_first(|&x| x > 5), None);
+ ///
+ /// // An iterator of Results can return the first Ok or the first Err:
+ /// let input = vec![Err(()), Ok(11), Err(()), Ok(22)];
+ /// assert_eq!(input.into_iter().find_or_first(Result::is_ok), Some(Ok(11)));
+ ///
+ /// let input: Vec<Result<(), i32>> = vec![Err(11), Err(22)];
+ /// assert_eq!(input.into_iter().find_or_first(Result::is_ok), Some(Err(11)));
+ ///
+ /// assert_eq!(std::iter::empty::<Result<(), i32>>().find_or_first(Result::is_ok), None);
/// ```
fn find_or_first<P>(mut self, mut predicate: P) -> Option<Self::Item>
where
@@ -2056,7 +2181,7 @@
where
Self: Sized,
Self::Item: Borrow<Q>,
- Q: PartialEq,
+ Q: PartialEq + ?Sized,
{
self.any(|x| x.borrow() == query)
}
@@ -2154,7 +2279,7 @@
/// ```
/// use itertools::Itertools;
///
- /// let mut iter = "αβγ".chars().dropping(2);
+ /// let iter = "αβγ".chars().dropping(2);
/// itertools::assert_equal(iter, "γ".chars());
/// ```
///
@@ -2238,14 +2363,17 @@
///
/// fn process_dir_entries(entries: &[fs::DirEntry]) {
/// // ...
+ /// # let _ = entries;
/// }
///
- /// fn do_stuff() -> std::io::Result<()> {
+ /// fn do_stuff() -> io::Result<()> {
/// let entries: Vec<_> = fs::read_dir(".")?.try_collect()?;
/// process_dir_entries(&entries);
///
/// Ok(())
/// }
+ ///
+ /// # let _ = do_stuff;
/// ```
fn try_collect<T, U, E>(self) -> Result<U, E>
where
@@ -2396,6 +2524,7 @@
/// accum = f(accum, 1);
/// accum = f(accum, 2);
/// accum = f(accum, 3);
+ /// # let _ = accum;
/// ```
///
/// With a `start` value of 0 and an addition as folding function,
@@ -2520,34 +2649,64 @@
///
/// If `f` is associative you should also decide carefully:
///
- /// - if `f` is a trivial operation like `u32::wrapping_add`, prefer the normal
- /// [`Iterator::reduce`] instead since it will most likely result in the generation of simpler
- /// code because the compiler is able to optimize it
- /// - otherwise if `f` is non-trivial like `format!`, you should use `tree_reduce` since it
- /// reduces the number of operations from `O(n)` to `O(ln(n))`
+ /// For an iterator producing `n` elements, both [`Iterator::reduce`] and `tree_reduce` will
+ /// call `f` `n - 1` times. However, `tree_reduce` will call `f` on earlier intermediate
+ /// results, which is beneficial for `f` that allocate and produce longer results for longer
+ /// arguments. For example if `f` combines arguments using `format!`, then `tree_reduce` will
+ /// operate on average on shorter arguments resulting in less bytes being allocated overall.
///
- /// Here "non-trivial" means:
+ /// Moreover, the output of `tree_reduce` is preferable to that of [`Iterator::reduce`] in
+ /// certain cases. For example, building a binary search tree using `tree_reduce` will result in
+ /// a balanced tree with height `O(ln(n))`, while [`Iterator::reduce`] will output a tree with
+ /// height `O(n)`, essentially a linked list.
///
- /// - any allocating operation
- /// - any function that is a composition of many operations
+ /// If `f` does not benefit from such a reordering, like `u32::wrapping_add`, prefer the
+ /// normal [`Iterator::reduce`] instead since it will most likely result in the generation of
+ /// simpler code because the compiler is able to optimize it.
///
/// ```
/// use itertools::Itertools;
///
- /// // The same tree as above
- /// let num_strings = (1..8).map(|x| x.to_string());
- /// assert_eq!(num_strings.tree_reduce(|x, y| format!("f({}, {})", x, y)),
- /// Some(String::from("f(f(f(1, 2), f(3, 4)), f(f(5, 6), 7))")));
+ /// let f = |a: String, b: String| {
+ /// format!("f({a}, {b})")
+ /// };
///
- /// // Like fold1, an empty iterator produces None
+ /// // The same tree as above
+ /// assert_eq!((1..8).map(|x| x.to_string()).tree_reduce(f),
+ /// Some(String::from("f(f(f(1, 2), f(3, 4)), f(f(5, 6), 7))")));
+ ///
+ /// // Like reduce, an empty iterator produces None
/// assert_eq!((0..0).tree_reduce(|x, y| x * y), None);
///
- /// // tree_reduce matches fold1 for associative operations...
+ /// // tree_reduce matches reduce for associative operations...
/// assert_eq!((0..10).tree_reduce(|x, y| x + y),
- /// (0..10).fold1(|x, y| x + y));
+ /// (0..10).reduce(|x, y| x + y));
+ ///
/// // ...but not for non-associative ones
/// assert_ne!((0..10).tree_reduce(|x, y| x - y),
- /// (0..10).fold1(|x, y| x - y));
+ /// (0..10).reduce(|x, y| x - y));
+ ///
+ /// let mut total_len_reduce = 0;
+ /// let reduce_res = (1..100).map(|x| x.to_string())
+ /// .reduce(|a, b| {
+ /// let r = f(a, b);
+ /// total_len_reduce += r.len();
+ /// r
+ /// })
+ /// .unwrap();
+ ///
+ /// let mut total_len_tree_reduce = 0;
+ /// let tree_reduce_res = (1..100).map(|x| x.to_string())
+ /// .tree_reduce(|a, b| {
+ /// let r = f(a, b);
+ /// total_len_tree_reduce += r.len();
+ /// r
+ /// })
+ /// .unwrap();
+ ///
+ /// assert_eq!(total_len_reduce, 33299);
+ /// assert_eq!(total_len_tree_reduce, 4228);
+ /// assert_eq!(reduce_res.len(), tree_reduce_res.len());
/// ```
fn tree_reduce<F>(mut self, mut f: F) -> Option<Self::Item>
where
@@ -3115,6 +3274,105 @@
self.k_smallest_by(k, k_smallest::key_to_cmp(key))
}
+ /// Sort the k smallest elements into a new iterator, in ascending order, relaxing the amount of memory required.
+ ///
+ /// **Note:** This consumes the entire iterator, and returns the result
+ /// as a new iterator that owns its elements. If the input contains
+ /// less than k elements, the result is equivalent to `self.sorted()`.
+ ///
+ /// This is guaranteed to use `2 * k * sizeof(Self::Item) + O(1)` memory
+ /// and `O(n + k log k)` time, with `n` the number of elements in the input,
+ /// meaning it uses more memory than the minimum obtained by [`k_smallest`](Itertools::k_smallest)
+ /// but achieves linear time in the number of elements.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// **Note:** This is functionally-equivalent to `self.sorted().take(k)`
+ /// but much more efficient.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_smallest = numbers
+ /// .into_iter()
+ /// .k_smallest_relaxed(5);
+ ///
+ /// itertools::assert_equal(five_smallest, 0..5);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_smallest_relaxed(self, k: usize) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ Self::Item: Ord,
+ {
+ self.k_smallest_relaxed_by(k, Ord::cmp)
+ }
+
+ /// Sort the k smallest elements into a new iterator using the provided comparison, relaxing the amount of memory required.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// This corresponds to `self.sorted_by(cmp).take(k)` in the same way that
+ /// [`k_smallest_relaxed`](Itertools::k_smallest_relaxed) corresponds to `self.sorted().take(k)`,
+ /// in both semantics and complexity.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_smallest = numbers
+ /// .into_iter()
+ /// .k_smallest_relaxed_by(5, |a, b| (a % 7).cmp(&(b % 7)).then(a.cmp(b)));
+ ///
+ /// itertools::assert_equal(five_smallest, vec![0, 7, 14, 1, 8]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_smallest_relaxed_by<F>(self, k: usize, cmp: F) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ F: FnMut(&Self::Item, &Self::Item) -> Ordering,
+ {
+ k_smallest::k_smallest_relaxed_general(self, k, cmp).into_iter()
+ }
+
+ /// Return the elements producing the k smallest outputs of the provided function, relaxing the amount of memory required.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// This corresponds to `self.sorted_by_key(key).take(k)` in the same way that
+ /// [`k_smallest_relaxed`](Itertools::k_smallest_relaxed) corresponds to `self.sorted().take(k)`,
+ /// in both semantics and complexity.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_smallest = numbers
+ /// .into_iter()
+ /// .k_smallest_relaxed_by_key(5, |n| (n % 7, *n));
+ ///
+ /// itertools::assert_equal(five_smallest, vec![0, 7, 14, 1, 8]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_smallest_relaxed_by_key<F, K>(self, k: usize, key: F) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ F: FnMut(&Self::Item) -> K,
+ K: Ord,
+ {
+ self.k_smallest_relaxed_by(k, k_smallest::key_to_cmp(key))
+ }
+
/// Sort the k largest elements into a new iterator, in descending order.
///
/// The sorted iterator, if directly collected to a `Vec`, is converted
@@ -3205,6 +3463,94 @@
self.k_largest_by(k, k_smallest::key_to_cmp(key))
}
+ /// Sort the k largest elements into a new iterator, in descending order, relaxing the amount of memory required.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// It is semantically equivalent to [`k_smallest_relaxed`](Itertools::k_smallest_relaxed)
+ /// with a reversed `Ord`.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_largest = numbers
+ /// .into_iter()
+ /// .k_largest_relaxed(5);
+ ///
+ /// itertools::assert_equal(five_largest, vec![14, 13, 12, 11, 10]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_largest_relaxed(self, k: usize) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ Self::Item: Ord,
+ {
+ self.k_largest_relaxed_by(k, Self::Item::cmp)
+ }
+
+ /// Sort the k largest elements into a new iterator using the provided comparison, relaxing the amount of memory required.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// Functionally equivalent to [`k_smallest_relaxed_by`](Itertools::k_smallest_relaxed_by)
+ /// with a reversed `Ord`.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_largest = numbers
+ /// .into_iter()
+ /// .k_largest_relaxed_by(5, |a, b| (a % 7).cmp(&(b % 7)).then(a.cmp(b)));
+ ///
+ /// itertools::assert_equal(five_largest, vec![13, 6, 12, 5, 11]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_largest_relaxed_by<F>(self, k: usize, mut cmp: F) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ F: FnMut(&Self::Item, &Self::Item) -> Ordering,
+ {
+ self.k_smallest_relaxed_by(k, move |a, b| cmp(b, a))
+ }
+
+ /// Return the elements producing the k largest outputs of the provided function, relaxing the amount of memory required.
+ ///
+ /// The sorted iterator, if directly collected to a `Vec`, is converted
+ /// without any extra copying or allocation cost.
+ ///
+ /// Functionally equivalent to [`k_smallest_relaxed_by_key`](Itertools::k_smallest_relaxed_by_key)
+ /// with a reversed `Ord`.
+ ///
+ /// ```
+ /// use itertools::Itertools;
+ ///
+ /// // A random permutation of 0..15
+ /// let numbers = vec![6, 9, 1, 14, 0, 4, 8, 7, 11, 2, 10, 3, 13, 12, 5];
+ ///
+ /// let five_largest = numbers
+ /// .into_iter()
+ /// .k_largest_relaxed_by_key(5, |n| (n % 7, *n));
+ ///
+ /// itertools::assert_equal(five_largest, vec![13, 6, 12, 5, 11]);
+ /// ```
+ #[cfg(feature = "use_alloc")]
+ fn k_largest_relaxed_by_key<F, K>(self, k: usize, key: F) -> VecIntoIter<Self::Item>
+ where
+ Self: Sized,
+ F: FnMut(&Self::Item) -> K,
+ K: Ord,
+ {
+ self.k_largest_relaxed_by(k, k_smallest::key_to_cmp(key))
+ }
+
/// Consumes the iterator and return an iterator of the last `n` elements.
///
/// The iterator, if directly collected to a `VecDeque`, is converted
@@ -3357,8 +3703,8 @@
group_map::into_group_map(self)
}
- /// Return an `Iterator` on a `HashMap`. Keys mapped to `Vec`s of values. The key is specified
- /// in the closure.
+ /// Return a `HashMap` of keys mapped to `Vec`s of values. The key is specified
+ /// in the closure. The values are taken from the input iterator.
///
/// Essentially a shorthand for `.into_grouping_map_by(f).collect::<Vec<_>>()`.
///
@@ -3370,7 +3716,7 @@
/// let lookup: HashMap<u32,Vec<(u32, u32)>> =
/// data.clone().into_iter().into_group_map_by(|a| a.0);
///
- /// assert_eq!(lookup[&0], vec![(0,10),(0,20)]);
+ /// assert_eq!(lookup[&0], vec![(0,10), (0,20)]);
/// assert_eq!(lookup.get(&1), None);
/// assert_eq!(lookup[&2], vec![(2,12), (2,42)]);
/// assert_eq!(lookup[&3], vec![(3,13), (3,33)]);
@@ -4125,7 +4471,7 @@
/// # Examples
/// ```
/// # use itertools::Itertools;
- /// let counts = [1, 1, 1, 3, 3, 5].into_iter().counts();
+ /// let counts = [1, 1, 1, 3, 3, 5].iter().counts();
/// assert_eq!(counts[&1], 3);
/// assert_eq!(counts[&3], 2);
/// assert_eq!(counts[&5], 1);
@@ -4151,6 +4497,7 @@
/// # use itertools::Itertools;
/// struct Character {
/// first_name: &'static str,
+ /// # #[allow(dead_code)]
/// last_name: &'static str,
/// }
///
@@ -4268,6 +4615,7 @@
/// assert_equal("exceed".split('c'), "excess".split('c'));
/// // ^PANIC: panicked at 'Failed assertion Some("eed") == Some("ess") for iteration 1'.
/// ```
+#[track_caller]
pub fn assert_equal<I, J>(a: I, b: J)
where
I: IntoIterator,
diff --git a/crates/itertools/src/merge_join.rs b/crates/itertools/src/merge_join.rs
index c0de35f..5f4a605 100644
--- a/crates/itertools/src/merge_join.rs
+++ b/crates/itertools/src/merge_join.rs
@@ -31,6 +31,7 @@
///
/// for elt in merge(&[1, 2, 3], &[2, 3, 4]) {
/// /* loop body */
+/// # let _ = elt;
/// }
/// ```
pub fn merge<I, J>(
diff --git a/crates/itertools/src/next_array.rs b/crates/itertools/src/next_array.rs
new file mode 100644
index 0000000..86480b1
--- /dev/null
+++ b/crates/itertools/src/next_array.rs
@@ -0,0 +1,269 @@
+use core::mem::{self, MaybeUninit};
+
+/// An array of at most `N` elements.
+struct ArrayBuilder<T, const N: usize> {
+ /// The (possibly uninitialized) elements of the `ArrayBuilder`.
+ ///
+ /// # Safety
+ ///
+ /// The elements of `arr[..len]` are valid `T`s.
+ arr: [MaybeUninit<T>; N],
+
+ /// The number of leading elements of `arr` that are valid `T`s, len <= N.
+ len: usize,
+}
+
+impl<T, const N: usize> ArrayBuilder<T, N> {
+ /// Initializes a new, empty `ArrayBuilder`.
+ pub fn new() -> Self {
+ // SAFETY: The safety invariant of `arr` trivially holds for `len = 0`.
+ Self {
+ arr: [(); N].map(|_| MaybeUninit::uninit()),
+ len: 0,
+ }
+ }
+
+ /// Pushes `value` onto the end of the array.
+ ///
+ /// # Panics
+ ///
+ /// This panics if `self.len >= N`.
+ #[inline(always)]
+ pub fn push(&mut self, value: T) {
+ // PANICS: This will panic if `self.len >= N`.
+ let place = &mut self.arr[self.len];
+ // SAFETY: The safety invariant of `self.arr` applies to elements at
+ // indices `0..self.len` — not to the element at `self.len`. Writing to
+ // the element at index `self.len` therefore does not violate the safety
+ // invariant of `self.arr`. Even if this line panics, we have not
+ // created any intermediate invalid state.
+ *place = MaybeUninit::new(value);
+ // Lemma: `self.len < N`. By invariant, `self.len <= N`. Above, we index
+ // into `self.arr`, which has size `N`, at index `self.len`. If `self.len == N`
+ // at that point, that index would be out-of-bounds, and the index
+ // operation would panic. Thus, `self.len != N`, and since `self.len <= N`,
+ // that means that `self.len < N`.
+ //
+ // PANICS: Since `self.len < N`, and since `N <= usize::MAX`,
+ // `self.len + 1 <= usize::MAX`, and so `self.len += 1` will not
+ // overflow. Overflow is the only panic condition of `+=`.
+ //
+ // SAFETY:
+ // - We are required to uphold the invariant that `self.len <= N`.
+ // Since, by the preceding lemma, `self.len < N` at this point in the
+ // code, `self.len += 1` results in `self.len <= N`.
+ // - We are required to uphold the invariant that `self.arr[..self.len]`
+ // are valid instances of `T`. Since this invariant already held when
+ // this method was called, and since we only increment `self.len`
+ // by 1 here, we only need to prove that the element at
+ // `self.arr[self.len]` (using the value of `self.len` before incrementing)
+ // is valid. Above, we construct `place` to point to `self.arr[self.len]`,
+ // and then initialize `*place` to `MaybeUninit::new(value)`, which is
+ // a valid `T` by construction.
+ self.len += 1;
+ }
+
+ /// Consumes the elements in the `ArrayBuilder` and returns them as an array
+ /// `[T; N]`.
+ ///
+ /// If `self.len() < N`, this returns `None`.
+ pub fn take(&mut self) -> Option<[T; N]> {
+ if self.len == N {
+ // SAFETY: Decreasing the value of `self.len` cannot violate the
+ // safety invariant on `self.arr`.
+ self.len = 0;
+
+ // SAFETY: Since `self.len` is 0, `self.arr` may safely contain
+ // uninitialized elements.
+ let arr = mem::replace(&mut self.arr, [(); N].map(|_| MaybeUninit::uninit()));
+
+ Some(arr.map(|v| {
+ // SAFETY: We know that all elements of `arr` are valid because
+ // we checked that `len == N`.
+ unsafe { v.assume_init() }
+ }))
+ } else {
+ None
+ }
+ }
+}
+
+impl<T, const N: usize> AsMut<[T]> for ArrayBuilder<T, N> {
+ fn as_mut(&mut self) -> &mut [T] {
+ let valid = &mut self.arr[..self.len];
+ // SAFETY: By invariant on `self.arr`, the elements of `self.arr` at
+ // indices `0..self.len` are in a valid state. Since `valid` references
+ // only these elements, the safety precondition of
+ // `slice_assume_init_mut` is satisfied.
+ unsafe { slice_assume_init_mut(valid) }
+ }
+}
+
+impl<T, const N: usize> Drop for ArrayBuilder<T, N> {
+ // We provide a non-trivial `Drop` impl, because the trivial impl would be a
+ // no-op; `MaybeUninit<T>` has no innate awareness of its own validity, and
+ // so it can only forget its contents. By leveraging the safety invariant of
+ // `self.arr`, we do know which elements of `self.arr` are valid, and can
+ // selectively run their destructors.
+ fn drop(&mut self) {
+ // SAFETY:
+ // - by invariant on `&mut [T]`, `self.as_mut()` is:
+ // - valid for reads and writes
+ // - properly aligned
+ // - non-null
+ // - the dropped `T` are valid for dropping; they do not have any
+ // additional library invariants that we've violated
+ // - no other pointers to `valid` exist (since we're in the context of
+ // `drop`)
+ unsafe { core::ptr::drop_in_place(self.as_mut()) }
+ }
+}
+
+/// Assuming all the elements are initialized, get a mutable slice to them.
+///
+/// # Safety
+///
+/// The caller guarantees that the elements `T` referenced by `slice` are in a
+/// valid state.
+unsafe fn slice_assume_init_mut<T>(slice: &mut [MaybeUninit<T>]) -> &mut [T] {
+ // SAFETY: Casting `&mut [MaybeUninit<T>]` to `&mut [T]` is sound, because
+ // `MaybeUninit<T>` is guaranteed to have the same size, alignment and ABI
+ // as `T`, and because the caller has guaranteed that `slice` is in the
+ // valid state.
+ unsafe { &mut *(slice as *mut [MaybeUninit<T>] as *mut [T]) }
+}
+
+/// Equivalent to `it.next_array()`.
+pub(crate) fn next_array<I, const N: usize>(it: &mut I) -> Option<[I::Item; N]>
+where
+ I: Iterator,
+{
+ let mut builder = ArrayBuilder::new();
+ for _ in 0..N {
+ builder.push(it.next()?);
+ }
+ builder.take()
+}
+
+#[cfg(test)]
+mod test {
+ use super::ArrayBuilder;
+
+ #[test]
+ fn zero_len_take() {
+ let mut builder = ArrayBuilder::<(), 0>::new();
+ let taken = builder.take();
+ assert_eq!(taken, Some([(); 0]));
+ }
+
+ #[test]
+ #[should_panic]
+ fn zero_len_push() {
+ let mut builder = ArrayBuilder::<(), 0>::new();
+ builder.push(());
+ }
+
+ #[test]
+ fn push_4() {
+ let mut builder = ArrayBuilder::<(), 4>::new();
+ assert_eq!(builder.take(), None);
+
+ builder.push(());
+ assert_eq!(builder.take(), None);
+
+ builder.push(());
+ assert_eq!(builder.take(), None);
+
+ builder.push(());
+ assert_eq!(builder.take(), None);
+
+ builder.push(());
+ assert_eq!(builder.take(), Some([(); 4]));
+ }
+
+ #[test]
+ fn tracked_drop() {
+ use std::panic::{catch_unwind, AssertUnwindSafe};
+ use std::sync::atomic::{AtomicU16, Ordering};
+
+ static DROPPED: AtomicU16 = AtomicU16::new(0);
+
+ #[derive(Debug, PartialEq)]
+ struct TrackedDrop;
+
+ impl Drop for TrackedDrop {
+ fn drop(&mut self) {
+ DROPPED.fetch_add(1, Ordering::Relaxed);
+ }
+ }
+
+ {
+ let builder = ArrayBuilder::<TrackedDrop, 0>::new();
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 0);
+ drop(builder);
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 0);
+ }
+
+ {
+ let mut builder = ArrayBuilder::<TrackedDrop, 2>::new();
+ builder.push(TrackedDrop);
+ assert_eq!(builder.take(), None);
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 0);
+ drop(builder);
+ assert_eq!(DROPPED.swap(0, Ordering::Relaxed), 1);
+ }
+
+ {
+ let mut builder = ArrayBuilder::<TrackedDrop, 2>::new();
+ builder.push(TrackedDrop);
+ builder.push(TrackedDrop);
+ assert!(matches!(builder.take(), Some(_)));
+ assert_eq!(DROPPED.swap(0, Ordering::Relaxed), 2);
+ drop(builder);
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 0);
+ }
+
+ {
+ let mut builder = ArrayBuilder::<TrackedDrop, 2>::new();
+
+ builder.push(TrackedDrop);
+ builder.push(TrackedDrop);
+
+ assert!(catch_unwind(AssertUnwindSafe(|| {
+ builder.push(TrackedDrop);
+ }))
+ .is_err());
+
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 1);
+
+ drop(builder);
+
+ assert_eq!(DROPPED.swap(0, Ordering::Relaxed), 3);
+ }
+
+ {
+ let mut builder = ArrayBuilder::<TrackedDrop, 2>::new();
+
+ builder.push(TrackedDrop);
+ builder.push(TrackedDrop);
+
+ assert!(catch_unwind(AssertUnwindSafe(|| {
+ builder.push(TrackedDrop);
+ }))
+ .is_err());
+
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 1);
+
+ assert!(matches!(builder.take(), Some(_)));
+
+ assert_eq!(DROPPED.load(Ordering::Relaxed), 3);
+
+ builder.push(TrackedDrop);
+ builder.push(TrackedDrop);
+
+ assert!(matches!(builder.take(), Some(_)));
+
+ assert_eq!(DROPPED.swap(0, Ordering::Relaxed), 5);
+ }
+ }
+}
diff --git a/crates/itertools/src/peeking_take_while.rs b/crates/itertools/src/peeking_take_while.rs
index 19872a9..f3259a9 100644
--- a/crates/itertools/src/peeking_take_while.rs
+++ b/crates/itertools/src/peeking_take_while.rs
@@ -22,7 +22,7 @@
F: FnOnce(&Self::Item) -> bool;
}
-impl<'a, I> PeekingNext for &'a mut I
+impl<I> PeekingNext for &mut I
where
I: PeekingNext,
{
@@ -133,7 +133,7 @@
PeekingTakeWhile { iter, f }
}
-impl<'a, I, F> Iterator for PeekingTakeWhile<'a, I, F>
+impl<I, F> Iterator for PeekingTakeWhile<'_, I, F>
where
I: PeekingNext,
F: FnMut(&I::Item) -> bool,
@@ -148,7 +148,7 @@
}
}
-impl<'a, I, F> PeekingNext for PeekingTakeWhile<'a, I, F>
+impl<I, F> PeekingNext for PeekingTakeWhile<'_, I, F>
where
I: PeekingNext,
F: FnMut(&I::Item) -> bool,
diff --git a/crates/itertools/src/process_results_impl.rs b/crates/itertools/src/process_results_impl.rs
index ad6c60d..31389c5 100644
--- a/crates/itertools/src/process_results_impl.rs
+++ b/crates/itertools/src/process_results_impl.rs
@@ -13,7 +13,7 @@
iter: I,
}
-impl<'a, I, E> ProcessResults<'a, I, E> {
+impl<I, E> ProcessResults<'_, I, E> {
#[inline(always)]
fn next_body<T>(&mut self, item: Option<Result<T, E>>) -> Option<T> {
match item {
@@ -27,7 +27,7 @@
}
}
-impl<'a, I, T, E> Iterator for ProcessResults<'a, I, E>
+impl<I, T, E> Iterator for ProcessResults<'_, I, E>
where
I: Iterator<Item = Result<T, E>>,
{
@@ -60,7 +60,7 @@
}
}
-impl<'a, I, T, E> DoubleEndedIterator for ProcessResults<'a, I, E>
+impl<I, T, E> DoubleEndedIterator for ProcessResults<'_, I, E>
where
I: Iterator<Item = Result<T, E>>,
I: DoubleEndedIterator,
diff --git a/crates/itertools/src/rciter_impl.rs b/crates/itertools/src/rciter_impl.rs
index e3b7532..96a0fd6 100644
--- a/crates/itertools/src/rciter_impl.rs
+++ b/crates/itertools/src/rciter_impl.rs
@@ -87,7 +87,7 @@
}
/// Return an iterator from `&RcIter<I>` (by simply cloning it).
-impl<'a, I> IntoIterator for &'a RcIter<I>
+impl<I> IntoIterator for &RcIter<I>
where
I: Iterator,
{
diff --git a/crates/itertools/src/zip_eq_impl.rs b/crates/itertools/src/zip_eq_impl.rs
index 6d3b682..3240a40 100644
--- a/crates/itertools/src/zip_eq_impl.rs
+++ b/crates/itertools/src/zip_eq_impl.rs
@@ -21,6 +21,7 @@
/// let data = [1, 2, 3, 4, 5];
/// for (a, b) in zip_eq(&data[..data.len() - 1], &data[1..]) {
/// /* loop body */
+/// # let _ = (a, b);
/// }
/// ```
pub fn zip_eq<I, J>(i: I, j: J) -> ZipEq<I::IntoIter, J::IntoIter>
diff --git a/crates/itertools/tests/macros_hygiene.rs b/crates/itertools/tests/macros_hygiene.rs
index 20b59fb..e6e8955 100644
--- a/crates/itertools/tests/macros_hygiene.rs
+++ b/crates/itertools/tests/macros_hygiene.rs
@@ -1,3 +1,8 @@
+mod alloc {}
+mod core {}
+mod either {}
+mod std {}
+
#[test]
fn iproduct_hygiene() {
let _ = itertools::iproduct!();
@@ -12,3 +17,11 @@
let _ = itertools::izip!(0..6, 0..9);
let _ = itertools::izip!(0..6, 0..9, 0..12);
}
+
+#[test]
+fn chain_hygiene() {
+ let _: ::std::iter::Empty<i32> = itertools::chain!();
+ let _ = itertools::chain!(0..6);
+ let _ = itertools::chain!(0..6, 0..9);
+ let _ = itertools::chain!(0..6, 0..9, 0..12);
+}
diff --git a/crates/itertools/tests/quick.rs b/crates/itertools/tests/quick.rs
index 5b8fd6a..672901e 100644
--- a/crates/itertools/tests/quick.rs
+++ b/crates/itertools/tests/quick.rs
@@ -2,7 +2,11 @@
//! and adaptors.
//!
//! In particular we test the tedious size_hint and exact size correctness.
+//!
+//! **NOTE:** Due to performance limitations, these tests are not run with miri!
+//! They cannot be relied upon to discover soundness issues.
+#![cfg(not(miri))]
#![allow(deprecated, unstable_name_collisions)]
use itertools::free::{
@@ -253,7 +257,6 @@
let mut it = get_it();
for _ in 0..(counts.len() - 1) {
- #[allow(clippy::manual_assert)]
if it.next().is_none() {
panic!("Iterator shouldn't be finished, may not be deterministic");
}
@@ -1512,13 +1515,12 @@
acc + val
});
- // TODO: Swap `fold1` with stdlib's `reduce` when it's stabilized
let group_map_lookup = a.iter()
.map(|&b| b as u64)
.map(|i| (i % modulo, i))
.into_group_map()
.into_iter()
- .map(|(key, vals)| (key, vals.into_iter().fold1(|acc, val| acc + val).unwrap()))
+ .map(|(key, vals)| (key, vals.into_iter().reduce(|acc, val| acc + val).unwrap()))
.collect::<HashMap<_,_>>();
assert_eq!(lookup, group_map_lookup);
diff --git a/crates/itertools/tests/specializations.rs b/crates/itertools/tests/specializations.rs
index 7123114..e6694c8 100644
--- a/crates/itertools/tests/specializations.rs
+++ b/crates/itertools/tests/specializations.rs
@@ -1,3 +1,10 @@
+//! Test specializations of methods with default impls match the behavior of the
+//! default impls.
+//!
+//! **NOTE:** Due to performance limitations, these tests are not run with miri!
+//! They cannot be relied upon to discover soundness issues.
+
+#![cfg(not(miri))]
#![allow(unstable_name_collisions)]
use itertools::Itertools;
@@ -266,6 +273,16 @@
test_specializations(&v.into_iter().intersperse_with(|| 0));
}
+ fn array_combinations(v: Vec<u8>) -> TestResult {
+ if v.len() > 10 {
+ return TestResult::discard();
+ }
+ test_specializations(&v.iter().array_combinations::<1>());
+ test_specializations(&v.iter().array_combinations::<2>());
+ test_specializations(&v.iter().array_combinations::<3>());
+ TestResult::passed()
+ }
+
fn combinations(a: Vec<u8>, n: u8) -> TestResult {
if n > 3 || a.len() > 8 {
return TestResult::discard();
@@ -447,11 +464,15 @@
}
fn filter_ok(v: Vec<Result<u8, char>>) -> () {
- test_specializations(&v.into_iter().filter_ok(|&i| i < 20));
+ let it = v.into_iter().filter_ok(|&i| i < 20);
+ test_specializations(&it);
+ test_double_ended_specializations(&it);
}
fn filter_map_ok(v: Vec<Result<u8, char>>) -> () {
- test_specializations(&v.into_iter().filter_map_ok(|i| if i < 20 { Some(i * 2) } else { None }));
+ let it = v.into_iter().filter_map_ok(|i| if i < 20 { Some(i * 2) } else { None });
+ test_specializations(&it);
+ test_double_ended_specializations(&it);
}
// `SmallIter2<u8>` because `Vec<u8>` is too slow and we get bad coverage from a singleton like Option<u8>
diff --git a/crates/itertools/tests/test_core.rs b/crates/itertools/tests/test_core.rs
index 32af246..4936160 100644
--- a/crates/itertools/tests/test_core.rs
+++ b/crates/itertools/tests/test_core.rs
@@ -372,3 +372,28 @@
assert_eq!(v[1..3].iter().cloned().product1::<i32>(), Some(2));
assert_eq!(v[1..5].iter().cloned().product1::<i32>(), Some(24));
}
+
+#[test]
+fn next_array() {
+ let v = [1, 2, 3, 4, 5];
+ let mut iter = v.iter();
+ assert_eq!(iter.next_array(), Some([]));
+ assert_eq!(iter.next_array().map(|[&x, &y]| [x, y]), Some([1, 2]));
+ assert_eq!(iter.next_array().map(|[&x, &y]| [x, y]), Some([3, 4]));
+ assert_eq!(iter.next_array::<2>(), None);
+}
+
+#[test]
+fn collect_array() {
+ let v = [1, 2];
+ let iter = v.iter().cloned();
+ assert_eq!(iter.collect_array(), Some([1, 2]));
+
+ let v = [1];
+ let iter = v.iter().cloned();
+ assert_eq!(iter.collect_array::<2>(), None);
+
+ let v = [1, 2, 3];
+ let iter = v.iter().cloned();
+ assert_eq!(iter.collect_array::<2>(), None);
+}
diff --git a/crates/itertools/tests/test_std.rs b/crates/itertools/tests/test_std.rs
index 00246d5..ad391fa 100644
--- a/crates/itertools/tests/test_std.rs
+++ b/crates/itertools/tests/test_std.rs
@@ -491,6 +491,7 @@
it::assert_equal(v, vec![4, 3, 2, 1, 0]);
}
+#[cfg(not(miri))]
qc::quickcheck! {
fn k_smallest_range(n: i64, m: u16, k: u16) -> () {
// u16 is used to constrain k and m to 0..2¹⁶,
@@ -527,6 +528,42 @@
it::assert_equal(largest_by, sorted_largest.clone());
it::assert_equal(largest_by_key, sorted_largest);
}
+
+ fn k_smallest_relaxed_range(n: i64, m: u16, k: u16) -> () {
+ // u16 is used to constrain k and m to 0..2¹⁶,
+ // otherwise the test could use too much memory.
+ let (k, m) = (k as usize, m as u64);
+
+ let mut v: Vec<_> = (n..n.saturating_add(m as _)).collect();
+ // Generate a random permutation of n..n+m
+ v.shuffle(&mut thread_rng());
+
+ // Construct the right answers for the top and bottom elements
+ let mut sorted = v.clone();
+ sorted.sort();
+ // how many elements are we checking
+ let num_elements = min(k, m as _);
+
+ // Compute the top and bottom k in various combinations
+ let sorted_smallest = sorted[..num_elements].iter().cloned();
+ let smallest = v.iter().cloned().k_smallest_relaxed(k);
+ let smallest_by = v.iter().cloned().k_smallest_relaxed_by(k, Ord::cmp);
+ let smallest_by_key = v.iter().cloned().k_smallest_relaxed_by_key(k, |&x| x);
+
+ let sorted_largest = sorted[sorted.len() - num_elements..].iter().rev().cloned();
+ let largest = v.iter().cloned().k_largest_relaxed(k);
+ let largest_by = v.iter().cloned().k_largest_relaxed_by(k, Ord::cmp);
+ let largest_by_key = v.iter().cloned().k_largest_relaxed_by_key(k, |&x| x);
+
+ // Check the variations produce the same answers and that they're right
+ it::assert_equal(smallest, sorted_smallest.clone());
+ it::assert_equal(smallest_by, sorted_smallest.clone());
+ it::assert_equal(smallest_by_key, sorted_smallest);
+
+ it::assert_equal(largest, sorted_largest.clone());
+ it::assert_equal(largest_by, sorted_largest.clone());
+ it::assert_equal(largest_by_key, sorted_largest);
+ }
}
#[derive(Clone, Debug)]
@@ -571,8 +608,11 @@
I::Item: Ord + Debug,
{
let j = i.clone();
+ let i1 = i.clone();
+ let j1 = i.clone();
let k = k as usize;
- it::assert_equal(i.k_smallest(k), j.sorted().take(k))
+ it::assert_equal(i.k_smallest(k), j.sorted().take(k));
+ it::assert_equal(i1.k_smallest_relaxed(k), j1.sorted().take(k));
}
// Similar to `k_smallest_sort` but for our custom heap implementation.
@@ -582,8 +622,11 @@
I::Item: Ord + Debug,
{
let j = i.clone();
+ let i1 = i.clone();
+ let j1 = i.clone();
let k = k as usize;
- it::assert_equal(i.k_smallest_by(k, Ord::cmp), j.sorted().take(k))
+ it::assert_equal(i.k_smallest_by(k, Ord::cmp), j.sorted().take(k));
+ it::assert_equal(i1.k_smallest_relaxed_by(k, Ord::cmp), j1.sorted().take(k));
}
macro_rules! generic_test {
@@ -598,7 +641,9 @@
};
}
+#[cfg(not(miri))]
generic_test!(k_smallest_sort, u8, u16, u32, u64, i8, i16, i32, i64);
+#[cfg(not(miri))]
generic_test!(k_smallest_by_sort, u8, u16, u32, u64, i8, i16, i32, i64);
#[test]
@@ -1055,8 +1100,8 @@
#[test]
fn combinations_range_count() {
- for n in 0..=10 {
- for k in 0..=10 {
+ for n in 0..=7 {
+ for k in 0..=7 {
let len = binomial(n, k);
let mut it = (0..n).combinations(k);
assert_eq!(len, it.clone().count());
@@ -1077,7 +1122,7 @@
#[test]
fn combinations_inexact_size_hints() {
- for k in 0..=10 {
+ for k in 0..=7 {
let mut numbers = (0..18).filter(|i| i % 2 == 0); // 9 elements
let mut it = numbers.clone().combinations(k);
let real_n = numbers.clone().count();
@@ -1129,8 +1174,8 @@
#[test]
fn permutations_range_count() {
- for n in 0..=7 {
- for k in 0..=7 {
+ for n in 0..=4 {
+ for k in 0..=4 {
let len = if k <= n { (n - k + 1..=n).product() } else { 0 };
let mut it = (0..n).permutations(k);
assert_eq!(len, it.clone().count());
@@ -1162,6 +1207,7 @@
}
#[test]
+#[cfg(not(miri))]
fn combinations_with_replacement() {
// Pool smaller than n
it::assert_equal((0..1).combinations_with_replacement(2), vec![vec![0, 0]]);
@@ -1190,8 +1236,8 @@
#[test]
fn combinations_with_replacement_range_count() {
- for n in 0..=7 {
- for k in 0..=7 {
+ for n in 0..=4 {
+ for k in 0..=4 {
let len = binomial(usize::saturating_sub(n + k, 1), k);
let mut it = (0..n).combinations_with_replacement(k);
assert_eq!(len, it.clone().count());
@@ -1236,7 +1282,7 @@
assert_eq!((0..8).powerset().count(), 1 << 8);
assert_eq!((0..16).powerset().count(), 1 << 16);
- for n in 0..=10 {
+ for n in 0..=4 {
let mut it = (0..n).powerset();
let len = 2_usize.pow(n);
assert_eq!(len, it.clone().count());
diff --git a/crates/itertools/tests/zip.rs b/crates/itertools/tests/zip.rs
index 716ac20..daed31e 100644
--- a/crates/itertools/tests/zip.rs
+++ b/crates/itertools/tests/zip.rs
@@ -20,7 +20,7 @@
let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let v2 = &[10, 11, 12];
- assert_eq!(c.zip_longest(v.iter()).size_hint(), (std::usize::MAX, None));
+ assert_eq!(c.zip_longest(v.iter()).size_hint(), (usize::MAX, None));
assert_eq!(v.iter().zip_longest(v2.iter()).size_hint(), (10, Some(10)));
}
diff --git a/crates/no-panic/.android-checksum.json b/crates/no-panic/.android-checksum.json
index 1739cf2..b745728 100644
--- a/crates/no-panic/.android-checksum.json
+++ b/crates/no-panic/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"eb97545ac02b170f10608ed0563f2ae96d4bc3daf96704fc7f9491577495b178","Android.bp":"e795ce013cd8a4da1d99e43d01dbb6fd7e6dfb8a2277fac1aa538a71114e79d3","Cargo.toml":"f3c5940e337023a0c0f09fe3f18652a5552da6764fd3fb17c0e3026d8d1ccffa","LICENSE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-APACHE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"ced85b82d611f1d639c2730e0bfdb9478c2d61085e023cc92628c4a112ab7530","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"a9d532dbef4bae285460087ff5e253ec66c1611de46795bb14fd78193eaee12b","TEST_MAPPING":"a1d98c3cfd1bbd4748193f02060efba5b9a53bbf4ed3e75fd1a46df8f344ad6d","build.rs":"85708d6adece84c1c1666595a6b9501f02cc5e1016aae8582e43c934f84b19cc","cargo_embargo.json":"e83649ca23319b8752e6eb8e784d06555c52745f166d66677beaac3d52b48eb4","src/lib.rs":"d729c8c0747ce89c60635306af3409d798a7ecd321c550f247609841c86fcb8d","tests/compiletest/mod.rs":"7e88f1c0dbd4e53138120be073eb944a2d33ee72f65eac203788a36743e1e278","tests/test.rs":"d9c3a19160b58e69b4eebcd2f5cb2d1c59f20672ba599de36cbca6e1d3eb7bb6","tests/ui/async-fn.rs":"f9444d0296ee3bb19c25996a1fdeb402f0c6a0ad982857eed4060fbd06aef7f6","tests/ui/async-fn.stderr":"403d15b204d7703d477afc27167bf7bf112b33433f8a75aebfd1e00020dcbfa5","tests/ui/trait-fn.rs":"906b5ac0a2c1a4df474b358784ad725e3d7abb2b61e60857e31c834a7637a1da","tests/ui/trait-fn.stderr":"9e2cd40a327a9c9e58124ec1b3dc3b1a37005724c5aa73e4aa92d8b2634b7917"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"869cf81d75b5a6264c134d2fe342b12bacb38cf7abc7d8449e071c9a0ab14811","Android.bp":"a1c2c0cf6978359cf2b704cb8289577f76db3e3f83d85a6c10d1b2b784a9efa1","Cargo.toml":"aa0eeabb4ac95a95e7a162a254d3cd84b15329d5bd866c550aa7c19db7cb4efa","LICENSE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-APACHE":"50f827348bfd5def2df4f30cb41264072cf9c180bd9ed698437e8d85b2482754","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"d78795d44bf387a1d40d2bbbdb95009b52c419b21b58b18cd0b46ae734c43fc9","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"b520e5d0bea02ad6dd8b52f193fc2a7adc5eee9a299b8691046c95865b170a56","TEST_MAPPING":"a1d98c3cfd1bbd4748193f02060efba5b9a53bbf4ed3e75fd1a46df8f344ad6d","build.rs":"85708d6adece84c1c1666595a6b9501f02cc5e1016aae8582e43c934f84b19cc","cargo_embargo.json":"e83649ca23319b8752e6eb8e784d06555c52745f166d66677beaac3d52b48eb4","src/lib.rs":"aac92ca1bafaca509603d9f92060427479d0282090ba6ac325154ff1bb9dd02c","tests/compiletest/mod.rs":"7e88f1c0dbd4e53138120be073eb944a2d33ee72f65eac203788a36743e1e278","tests/test.rs":"d9c3a19160b58e69b4eebcd2f5cb2d1c59f20672ba599de36cbca6e1d3eb7bb6","tests/ui/async-fn.rs":"f9444d0296ee3bb19c25996a1fdeb402f0c6a0ad982857eed4060fbd06aef7f6","tests/ui/async-fn.stderr":"403d15b204d7703d477afc27167bf7bf112b33433f8a75aebfd1e00020dcbfa5","tests/ui/const-fn.rs":"f6aec18d4f08916f163f167cd4f83cdfe95a6b4f4019de5060d3e1d63428f1e0","tests/ui/const-fn.stderr":"fe08ebdf618720b6bf204d829de7cd8f4b259e99fb4d5b5591880a928259d7c5","tests/ui/trait-fn.rs":"906b5ac0a2c1a4df474b358784ad725e3d7abb2b61e60857e31c834a7637a1da","tests/ui/trait-fn.stderr":"9e2cd40a327a9c9e58124ec1b3dc3b1a37005724c5aa73e4aa92d8b2634b7917"}}
\ No newline at end of file
diff --git a/crates/no-panic/.cargo-checksum.json b/crates/no-panic/.cargo-checksum.json
index 9c6d991..0fc7a36 100644
--- a/crates/no-panic/.cargo-checksum.json
+++ b/crates/no-panic/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"84c87e834d11562966872c0af4dc0faba2547212ca53f0201c980385978ba339","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"dd9f016d4e5c0b6934b9632ee363d39a98da6e2ff05a99a9b20e0bef4dfd927e","build.rs":"d183bf1e325fcd8e132ec95105fdd90ef204818485b9d8ac3334f11ae2f0b6ca","src/lib.rs":"06deefa4eaa5405696334ce4f54dc5af2eaaf144bfdf2f29688a87c3b9624b63","tests/compiletest/mod.rs":"3150e73da18b506c070ea7c085380d6e6a2a00860af2a2f96554b26319b3fd0a","tests/test.rs":"5a82f041a9bed6ef3752337e8833921eebeb73fc7f26c73badc97211b00dc7fc","tests/ui/async-fn.rs":"152d5e8546b0b2016315486dddfd0cbe2d3b1a6c629faac6c8e8e645c96d6f78","tests/ui/async-fn.stderr":"2e797f13df99acd49d88c52b0d570e049f03e590f538e91409120b5a11cd3812","tests/ui/trait-fn.rs":"129f4d0dc4a227fe6cd3313a2e1835f3b1d4cec4dabb2f811e02a2a59e5e0a29","tests/ui/trait-fn.stderr":"0d7eedcce3e9d876cf2ef2940bd20224a5c0163c672ce05f8af86227347fe301"},"package":"13039f2e914d0c1b8674a6a63681cfb857c41f029920db505f850c36dee22df8"}
\ No newline at end of file
+{"files":{"Cargo.toml":"08f701a7b81e31ba31bcbe6269cef1820232722417020c8fe68bf9682dea402e","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"fde5df1ff2201ae6b6b01e6964b34040220f5c342b36ac3efe1beb542a6c8e17","build.rs":"d183bf1e325fcd8e132ec95105fdd90ef204818485b9d8ac3334f11ae2f0b6ca","src/lib.rs":"74c4e304278950c9e5b6018e884231bc3b8ca1016b4659ac89334f4d910473d7","tests/compiletest/mod.rs":"3150e73da18b506c070ea7c085380d6e6a2a00860af2a2f96554b26319b3fd0a","tests/test.rs":"5a82f041a9bed6ef3752337e8833921eebeb73fc7f26c73badc97211b00dc7fc","tests/ui/async-fn.rs":"152d5e8546b0b2016315486dddfd0cbe2d3b1a6c629faac6c8e8e645c96d6f78","tests/ui/async-fn.stderr":"2e797f13df99acd49d88c52b0d570e049f03e590f538e91409120b5a11cd3812","tests/ui/const-fn.rs":"b5e4d1d0ae2290d7bbd3a671d3dae2e44c4931b8ca61a7c0cbf9683d9a634866","tests/ui/const-fn.stderr":"e62e6fb411e8faea2879875a2f1c463fa1b41e50d3ff9126bbb0bd69cb6e4530","tests/ui/trait-fn.rs":"129f4d0dc4a227fe6cd3313a2e1835f3b1d4cec4dabb2f811e02a2a59e5e0a29","tests/ui/trait-fn.stderr":"0d7eedcce3e9d876cf2ef2940bd20224a5c0163c672ce05f8af86227347fe301"},"package":"8f7da86466fe446079286ef4b2f6d789755b610a9d85da8477633f734d2697e8"}
\ No newline at end of file
diff --git a/crates/no-panic/Android.bp b/crates/no-panic/Android.bp
index 617939a..0c73578 100644
--- a/crates/no-panic/Android.bp
+++ b/crates/no-panic/Android.bp
@@ -17,7 +17,7 @@
name: "libno_panic",
crate_name: "no_panic",
cargo_env_compat: true,
- cargo_pkg_version: "0.1.32",
+ cargo_pkg_version: "0.1.33",
crate_root: "src/lib.rs",
edition: "2021",
rustlibs: [
diff --git a/crates/no-panic/Cargo.toml b/crates/no-panic/Cargo.toml
index a896e91..0a4222a 100644
--- a/crates/no-panic/Cargo.toml
+++ b/crates/no-panic/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.56"
name = "no-panic"
-version = "0.1.32"
+version = "0.1.33"
authors = ["David Tolnay <[email protected]>"]
build = "build.rs"
autolib = false
diff --git a/crates/no-panic/METADATA b/crates/no-panic/METADATA
index 4e35567..f762493 100644
--- a/crates/no-panic/METADATA
+++ b/crates/no-panic/METADATA
@@ -1,17 +1,17 @@
name: "no-panic"
description: "Attribute macro to require that the compiler prove a function can\'t ever panic."
third_party {
- version: "0.1.32"
+ version: "0.1.33"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 12
- day: 21
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/no-panic"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/no-panic/no-panic-0.1.32.crate"
- version: "0.1.32"
+ value: "https://static.crates.io/crates/no-panic/no-panic-0.1.33.crate"
+ version: "0.1.33"
}
}
diff --git a/crates/no-panic/README.md b/crates/no-panic/README.md
index f54663d..01ad392 100644
--- a/crates/no-panic/README.md
+++ b/crates/no-panic/README.md
@@ -70,7 +70,13 @@
detection. This includes `cargo build` of library crates and `cargo check` of
binary and library crates.
-- The attribute is useless in code built with `panic = "abort"`.
+- The attribute is useless in code built with `panic = "abort"`. Code must be
+ built with `panic = "unwind"` (the default) in order for any panics to be
+ detected. After confirming absence of panics, you can of course still ship
+ your software as a `panic = "abort"` build.
+
+- Const functions are not supported. The attribute will fail to compile if
+ placed on a `const fn`.
If you find that code requires optimization to pass `#[no_panic]`, either make
no-panic an optional dependency that you only enable in release builds, or add a
diff --git a/crates/no-panic/src/lib.rs b/crates/no-panic/src/lib.rs
index 07823cd..65d0608 100644
--- a/crates/no-panic/src/lib.rs
+++ b/crates/no-panic/src/lib.rs
@@ -79,7 +79,13 @@
//! detection. This includes `cargo build` of library crates and `cargo check`
//! of binary and library crates.
//!
-//! - The attribute is useless in code built with `panic = "abort"`.
+//! - The attribute is useless in code built with `panic = "abort"`. Code must
+//! be built with `panic = "unwind"` (the default) in order for any panics to
+//! be detected. After confirming absence of panics, you can of course still
+//! ship your software as a `panic = "abort"` build.
+//!
+//! - Const functions are not supported. The attribute will fail to compile if
+//! placed on a `const fn`.
//!
//! If you find that code requires optimization to pass `#[no_panic]`, either
//! make no-panic an optional dependency that you only enable in release builds,
@@ -126,7 +132,7 @@
//! [Kixunil]: https://github.com/Kixunil
//! [`dont_panic`]: https://github.com/Kixunil/dont_panic
-#![doc(html_root_url = "https://docs.rs/no-panic/0.1.32")]
+#![doc(html_root_url = "https://docs.rs/no-panic/0.1.33")]
#![allow(
clippy::doc_markdown,
clippy::match_same_arms,
@@ -162,6 +168,12 @@
fn parse(args: TokenStream2, input: TokenStream2) -> Result<ItemFn> {
let function: ItemFn = syn::parse2(input)?;
let _: Nothing = syn::parse2::<Nothing>(args)?;
+ if function.sig.constness.is_some() {
+ return Err(Error::new(
+ Span::call_site(),
+ "no_panic attribute on const fn is not supported",
+ ));
+ }
if function.sig.asyncness.is_some() {
return Err(Error::new(
Span::call_site(),
diff --git a/crates/no-panic/tests/ui/const-fn.rs b/crates/no-panic/tests/ui/const-fn.rs
new file mode 100644
index 0000000..650d01a
--- /dev/null
+++ b/crates/no-panic/tests/ui/const-fn.rs
@@ -0,0 +1,6 @@
+use no_panic::no_panic;
+
+#[no_panic]
+const fn f() {}
+
+fn main() {}
diff --git a/crates/no-panic/tests/ui/const-fn.stderr b/crates/no-panic/tests/ui/const-fn.stderr
new file mode 100644
index 0000000..16c4c81
--- /dev/null
+++ b/crates/no-panic/tests/ui/const-fn.stderr
@@ -0,0 +1,7 @@
+error: no_panic attribute on const fn is not supported
+ --> tests/ui/const-fn.rs:3:1
+ |
+3 | #[no_panic]
+ | ^^^^^^^^^^^
+ |
+ = note: this error originates in the attribute macro `no_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/crates/pest_meta/.android-checksum.json b/crates/pest_meta/.android-checksum.json
index b07d72d..2f9f4ea 100644
--- a/crates/pest_meta/.android-checksum.json
+++ b/crates/pest_meta/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"728deb077efbf0ff6f05279cdce76927e5ed63208e50b7334ea829d21d798296","Android.bp":"cb10bb239aecf9719541ab6a8de39d9082b7e8f15bf1ebb802b52670eb543bb2","Cargo.toml":"72a99595341687abe21c931c3151f1b5898dcafc61f343f2269be6b72ff8cb0e","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"e4aa0957bcbdf64ce6b8a7a099561b6d49c0e465ec8678f4f1b69b70c432b6a7","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","_README.md":"6b973bfc5a49b890c6c47d4705f7f6ae59ec30552d0c3fd0fccf77bb1c694157","cargo_embargo.json":"c5d605ed2e9d4fee60736ad7fb51cae33b2e26c246def1fc511c1a97ddd8f82b","src/ast.rs":"9f9429e6156dd2404d50d1be2cb35074b35a575df1b92054c447fb9f13a59715","src/grammar.pest":"c251b4227b1f7bde4a8ce51da0dbda6f0b74e1a3656a0f89dc102059f45592b2","src/grammar.rs":"9bdd8d8b3e4b32ec02c30aa4ec6a6037a3be390b27a9f45dece6598a2e30aa9f","src/lib.rs":"94ee7173be768deddc652da00c552c66478322b9cb78c9e26b6fcffcd62fda08","src/optimizer/concatenator.rs":"f9274358964959ce93b448c76cd113d11bb4283ca1229ad74e240fa4b0f5b24d","src/optimizer/factorizer.rs":"0a867ef8594e8889b56e5dae47fd6b110caa27b4f44bcc1ebd9702aea05191c6","src/optimizer/lister.rs":"19543cd8a7fc8f77a02743ba2c11442df575e44efd02875ffdf763e34d7b8052","src/optimizer/mod.rs":"ae1e9246205ffc03462c568a2553e8e491c511a4d3ec0130c6003d8c2b2460b7","src/optimizer/restorer.rs":"03387bfe3184875c2669b9c3bb9e0e8edeed11649c3f0c68c8639dd18b928b9a","src/optimizer/rotater.rs":"da08287b320acdfabfac863afe93e5069f9f7f57d5ba26fac9f0465b0fa70e0a","src/optimizer/skipper.rs":"6e1197dd225be0ba44e401e1cbe0e4ed761a204e2abb8a3b3fcdfd7dc9b2d420","src/optimizer/unroller.rs":"5f1d2e532cee022c01c6ebd2d5b54c54c34903fefe386fb107a9791610729176","src/parser.rs":"711acef9d6395f885bb6b626f845f0f3da6cf98dd04ffc0cb1474e492b1b159d","src/validator.rs":"c753a92d07c5830819e447bd7187f5c6ff04483756d5a072d1e80f5bebf6809c"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"f64d124d3ae1a57dc3edabaec567b4788b07969eb5315553de5b1ec350e08d9d","Android.bp":"a2da9cb831076114cc9834b3b18af2eba09ad60f91486f75074cbf030d56cd65","Cargo.toml":"9d91c8c69fee2f7faf898dcdc11eb3750a4e3c41af6a4e046d6ce4d8d055178a","LICENSE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-APACHE":"3c7cd2396b5b772507febd2615d3d5a55b80103845037df77c87ba6e64872f2c","LICENSE-MIT":"38620a3cfaeec97a9197e8c39e436ea7f0bc86699b1f1c35f1aa41785b6d4eac","METADATA":"3c7d45f633c1ead8559a6f768f050573fc500a821368e0fe9b7336b52633f930","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","_README.md":"6b973bfc5a49b890c6c47d4705f7f6ae59ec30552d0c3fd0fccf77bb1c694157","cargo_embargo.json":"c5d605ed2e9d4fee60736ad7fb51cae33b2e26c246def1fc511c1a97ddd8f82b","src/ast.rs":"9f9429e6156dd2404d50d1be2cb35074b35a575df1b92054c447fb9f13a59715","src/grammar.pest":"c251b4227b1f7bde4a8ce51da0dbda6f0b74e1a3656a0f89dc102059f45592b2","src/grammar.rs":"d14610fdea41c41ea535ad86ada51f161f97e733aaf828d00f72201b15aeec41","src/lib.rs":"94ee7173be768deddc652da00c552c66478322b9cb78c9e26b6fcffcd62fda08","src/optimizer/concatenator.rs":"f9274358964959ce93b448c76cd113d11bb4283ca1229ad74e240fa4b0f5b24d","src/optimizer/factorizer.rs":"0a867ef8594e8889b56e5dae47fd6b110caa27b4f44bcc1ebd9702aea05191c6","src/optimizer/lister.rs":"19543cd8a7fc8f77a02743ba2c11442df575e44efd02875ffdf763e34d7b8052","src/optimizer/mod.rs":"fbb59c9d221bfd5a7b9a6645893c0ae3340d6c082de9965c5a298a35df49f759","src/optimizer/restorer.rs":"3b3b8818ea675061d279160a32ccdaed91896b528ba0d31f9f221514aee54fba","src/optimizer/rotater.rs":"da08287b320acdfabfac863afe93e5069f9f7f57d5ba26fac9f0465b0fa70e0a","src/optimizer/skipper.rs":"29b1f89b19798ca8e5204fe7abcb6b9d27da75ae9181bf1edf2799253ea73469","src/optimizer/unroller.rs":"5f1d2e532cee022c01c6ebd2d5b54c54c34903fefe386fb107a9791610729176","src/parser.rs":"0bfe373c4a60a86eca455a09878b07755683e31ac4a461b27401e6cf8d2c40cc","src/validator.rs":"b269baa100abfe80892853302a22c283cab3c26ce339169836a010aa0cccbef8"}}
\ No newline at end of file
diff --git a/crates/pest_meta/.cargo-checksum.json b/crates/pest_meta/.cargo-checksum.json
index 487346d..65fa7b3 100644
--- a/crates/pest_meta/.cargo-checksum.json
+++ b/crates/pest_meta/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"838c43e98436996c366fb27b44e148d43930bf6d7df263899c0438faab46c64d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","_README.md":"bde746653575153be4ae26ce950963ced5034449e352e60cfd8825260c666c16","src/ast.rs":"5787ea2618f7da5a7d9c63a8a9440d22a8f8676b33629ecfc4551b27475a522a","src/grammar.pest":"90077510db0513bed4eb723548aee349e85837ab3a4286a6379b32b9bc237ac8","src/grammar.rs":"d45d92df133c776d9dc5f0dc8638bbac2fe9914f19f50ba2cee60f5b8b0a0cf5","src/lib.rs":"a8cfd7c64bbd2b9dc9f0d21b4f3a6139095ead0964f12da86f4ee8079e546c1e","src/optimizer/concatenator.rs":"ab613bedc7001ab2057a8afee295ee72fc5ba7fc1017f6806477b8caa37af3c8","src/optimizer/factorizer.rs":"b79591db09a2066315f30398a5a2911db19c982ce49bbc7aa6acce894b4e3ede","src/optimizer/lister.rs":"01acfdcadd197c6a1d9dcf313ea9d0bf13983ef34a1c8638e5b439036b7ee924","src/optimizer/mod.rs":"4231e15d3cb283d49310bbe73f0ab39bd47d8f9922d3d4d4bd7f062e20dfb9c0","src/optimizer/restorer.rs":"8b65cfe7dfd4d812bee6ac3cdbcc3d0026e03fd2b456a7c866dd83e6fdbf26a7","src/optimizer/rotater.rs":"08da3716296a6bd7d1872b3dacd961814b87854cdd0d9c714974507fe7aca307","src/optimizer/skipper.rs":"4e9b01e93eac9225d4e05481ce362003bad05121f45543f55f58e5da89857a15","src/optimizer/unroller.rs":"f032acb6b13cfd12aaada312209db8c23e54d5159d9e7283c59887fe5b03aba0","src/parser.rs":"25d1970afde206d7f000cf67854632cd6ecbd6d1cae03ce9251191ae61044131","src/validator.rs":"98b02bead02f8d1dc36245dafb02658c63324a4549ee98f2c942b8356923c5d4"},"package":"a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d"}
\ No newline at end of file
+{"files":{"Cargo.toml":"7a19ed2c2474eb135ef362839128e4bafef4e4e8066e0cfd2500e9bee6459efc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","_README.md":"bde746653575153be4ae26ce950963ced5034449e352e60cfd8825260c666c16","src/ast.rs":"5787ea2618f7da5a7d9c63a8a9440d22a8f8676b33629ecfc4551b27475a522a","src/grammar.pest":"90077510db0513bed4eb723548aee349e85837ab3a4286a6379b32b9bc237ac8","src/grammar.rs":"e0c279feaa90be246169e38a366f99819643034adbb222dadb77c6f9614f01b7","src/lib.rs":"a8cfd7c64bbd2b9dc9f0d21b4f3a6139095ead0964f12da86f4ee8079e546c1e","src/optimizer/concatenator.rs":"ab613bedc7001ab2057a8afee295ee72fc5ba7fc1017f6806477b8caa37af3c8","src/optimizer/factorizer.rs":"b79591db09a2066315f30398a5a2911db19c982ce49bbc7aa6acce894b4e3ede","src/optimizer/lister.rs":"01acfdcadd197c6a1d9dcf313ea9d0bf13983ef34a1c8638e5b439036b7ee924","src/optimizer/mod.rs":"9cad0db9ae289493c3ef67ebe7075291a36005da530f4696ba5300bfd933d96c","src/optimizer/restorer.rs":"04c966b5add5b4b48eb7ffe5d4e3c05729fb09478609e6c77c6b723ec17dbd64","src/optimizer/rotater.rs":"08da3716296a6bd7d1872b3dacd961814b87854cdd0d9c714974507fe7aca307","src/optimizer/skipper.rs":"d786647fa1fdd541015bc195f9ff18ea5618ccca9dcb70ee13638813a89c5936","src/optimizer/unroller.rs":"f032acb6b13cfd12aaada312209db8c23e54d5159d9e7283c59887fe5b03aba0","src/parser.rs":"cfbbdf92047fd09a681f9e63468dc32fd763f6a85ccba8a88d76621ba3a816cb","src/validator.rs":"b0f450cda9e60e74ad51f091b28f496e194f14fb651df3a4ab15ed7fa6a432e6"},"package":"e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea"}
\ No newline at end of file
diff --git a/crates/pest_meta/Android.bp b/crates/pest_meta/Android.bp
index 0fd5041..dfefe3e 100644
--- a/crates/pest_meta/Android.bp
+++ b/crates/pest_meta/Android.bp
@@ -17,7 +17,7 @@
name: "libpest_meta",
crate_name: "pest_meta",
cargo_env_compat: true,
- cargo_pkg_version: "2.7.6",
+ cargo_pkg_version: "2.7.15",
crate_root: "src/lib.rs",
edition: "2021",
features: ["default"],
diff --git a/crates/pest_meta/Cargo.toml b/crates/pest_meta/Cargo.toml
index 2f5f2c5..05183f2 100644
--- a/crates/pest_meta/Cargo.toml
+++ b/crates/pest_meta/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.61"
name = "pest_meta"
-version = "2.7.6"
+version = "2.7.15"
authors = ["Dragoș Tiselice <[email protected]>"]
exclude = ["src/grammar.pest"]
include = [
@@ -41,10 +41,10 @@
version = "1.8.0"
[dependencies.pest]
-version = "2.7.6"
+version = "2.7.15"
[build-dependencies.cargo]
-version = "0.72.2"
+version = "0.81.0"
optional = true
[build-dependencies.sha2]
diff --git a/crates/pest_meta/METADATA b/crates/pest_meta/METADATA
index b03b94f..c2c6d19 100644
--- a/crates/pest_meta/METADATA
+++ b/crates/pest_meta/METADATA
@@ -1,17 +1,17 @@
name: "pest_meta"
description: "pest meta language parser and validator"
third_party {
- version: "2.7.6"
+ version: "2.7.15"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 2
- day: 5
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/pest_meta"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/pest_meta/pest_meta-2.7.6.crate"
- version: "2.7.6"
+ value: "https://static.crates.io/crates/pest_meta/pest_meta-2.7.15.crate"
+ version: "2.7.15"
}
}
diff --git a/crates/pest_meta/src/grammar.rs b/crates/pest_meta/src/grammar.rs
index 58cf5ff..3fcf4ab 100644
--- a/crates/pest_meta/src/grammar.rs
+++ b/crates/pest_meta/src/grammar.rs
@@ -1,2 +1,2 @@
pub struct PestParser;
-# [doc = "Pest meta-grammar\n\n# Warning: Semantic Versioning\nThere may be non-breaking changes to the meta-grammar\nbetween minor versions. Those non-breaking changes, however,\nmay translate into semver-breaking changes due to the additional variants\nadded to the `Rule` enum. This is a known issue and will be fixed in the\nfuture (e.g. by increasing MSRV and non_exhaustive annotations)."] # [allow (dead_code , non_camel_case_types , clippy :: upper_case_acronyms)] # [derive (Clone , Copy , Debug , Eq , Hash , Ord , PartialEq , PartialOrd)] pub enum Rule { # [doc = "End-of-input"] EOI , # [doc = "The top-level rule of a grammar."] r#grammar_rules , # [doc = "A rule of a grammar."] r#grammar_rule , # [doc = "Assignment operator."] r#assignment_operator , # [doc = "Opening brace for a rule."] r#opening_brace , # [doc = "Closing brace for a rule."] r#closing_brace , # [doc = "Opening parenthesis for a branch, PUSH, etc."] r#opening_paren , # [doc = "Closing parenthesis for a branch, PUSH, etc."] r#closing_paren , # [doc = "Opening bracket for PEEK (slice inside)."] r#opening_brack , # [doc = "Closing bracket for PEEK (slice inside)."] r#closing_brack , # [doc = "A rule modifier."] r#modifier , # [doc = "Silent rule prefix."] r#silent_modifier , # [doc = "Atomic rule prefix."] r#atomic_modifier , # [doc = "Compound atomic rule prefix."] r#compound_atomic_modifier , # [doc = "Non-atomic rule prefix."] r#non_atomic_modifier , # [doc = "A tag label."] r#tag_id , # [doc = "For assigning labels to nodes."] r#node_tag , # [doc = "A rule expression."] r#expression , # [doc = "A rule term."] r#term , # [doc = "A rule node (inside terms)."] r#node , # [doc = "A terminal expression."] r#terminal , # [doc = "Possible predicates for a rule."] r#prefix_operator , # [doc = "Branches or sequences."] r#infix_operator , # [doc = "Possible modifiers for a rule."] r#postfix_operator , # [doc = "A positive predicate."] r#positive_predicate_operator , # [doc = "A negative predicate."] r#negative_predicate_operator , # [doc = "A sequence operator."] r#sequence_operator , # [doc = "A choice operator."] r#choice_operator , # [doc = "An optional operator."] r#optional_operator , # [doc = "A repeat operator."] r#repeat_operator , # [doc = "A repeat at least once operator."] r#repeat_once_operator , # [doc = "A repeat exact times."] r#repeat_exact , # [doc = "A repeat at least times."] r#repeat_min , # [doc = "A repeat at most times."] r#repeat_max , # [doc = "A repeat in a range."] r#repeat_min_max , # [doc = "A number."] r#number , # [doc = "An integer number (positive or negative)."] r#integer , # [doc = "A comma terminal."] r#comma , # [doc = "A PUSH expression."] r#_push , # [doc = "A PEEK expression."] r#peek_slice , # [doc = "An identifier."] r#identifier , # [doc = "An alpha character."] r#alpha , # [doc = "An alphanumeric character."] r#alpha_num , # [doc = "A string."] r#string , # [doc = "An insensitive string."] r#insensitive_string , # [doc = "A character range."] r#range , # [doc = "A single quoted character"] r#character , # [doc = "A quoted string."] r#inner_str , # [doc = "An escaped or any character."] r#inner_chr , # [doc = "An escape sequence."] r#escape , # [doc = "A hexadecimal code."] r#code , # [doc = "A unicode code."] r#unicode , # [doc = "A hexadecimal digit."] r#hex_digit , # [doc = "A double quote."] r#quote , # [doc = "A single quote."] r#single_quote , # [doc = "A range operator."] r#range_operator , # [doc = "A newline character."] r#newline , # [doc = "A whitespace character."] r#WHITESPACE , # [doc = "A single line comment."] r#line_comment , # [doc = "A multi-line comment."] r#block_comment , # [doc = "A grammar comment."] r#COMMENT , # [doc = "A space character."] r#space , # [doc = "A top-level comment."] r#grammar_doc , # [doc = "A rule comment."] r#line_doc , # [doc = "A comment content."] r#inner_doc } impl Rule { pub fn all_rules () -> & 'static [Rule] { & [Rule :: r#grammar_rules , Rule :: r#grammar_rule , Rule :: r#assignment_operator , Rule :: r#opening_brace , Rule :: r#closing_brace , Rule :: r#opening_paren , Rule :: r#closing_paren , Rule :: r#opening_brack , Rule :: r#closing_brack , Rule :: r#modifier , Rule :: r#silent_modifier , Rule :: r#atomic_modifier , Rule :: r#compound_atomic_modifier , Rule :: r#non_atomic_modifier , Rule :: r#tag_id , Rule :: r#node_tag , Rule :: r#expression , Rule :: r#term , Rule :: r#node , Rule :: r#terminal , Rule :: r#prefix_operator , Rule :: r#infix_operator , Rule :: r#postfix_operator , Rule :: r#positive_predicate_operator , Rule :: r#negative_predicate_operator , Rule :: r#sequence_operator , Rule :: r#choice_operator , Rule :: r#optional_operator , Rule :: r#repeat_operator , Rule :: r#repeat_once_operator , Rule :: r#repeat_exact , Rule :: r#repeat_min , Rule :: r#repeat_max , Rule :: r#repeat_min_max , Rule :: r#number , Rule :: r#integer , Rule :: r#comma , Rule :: r#_push , Rule :: r#peek_slice , Rule :: r#identifier , Rule :: r#alpha , Rule :: r#alpha_num , Rule :: r#string , Rule :: r#insensitive_string , Rule :: r#range , Rule :: r#character , Rule :: r#inner_str , Rule :: r#inner_chr , Rule :: r#escape , Rule :: r#code , Rule :: r#unicode , Rule :: r#hex_digit , Rule :: r#quote , Rule :: r#single_quote , Rule :: r#range_operator , Rule :: r#newline , Rule :: r#WHITESPACE , Rule :: r#line_comment , Rule :: r#block_comment , Rule :: r#COMMENT , Rule :: r#space , Rule :: r#grammar_doc , Rule :: r#line_doc , Rule :: r#inner_doc] } } # [allow (clippy :: all)] impl :: pest :: Parser < Rule > for PestParser { fn parse < 'i > (rule : Rule , input : & 'i str) -> :: std :: result :: Result < :: pest :: iterators :: Pairs < 'i , Rule > , :: pest :: error :: Error < Rule > > { mod rules { # ! [allow (clippy :: upper_case_acronyms)] pub mod hidden { use super :: super :: Rule ; # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn skip (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { if state . atomicity () == :: pest :: Atomicity :: NonAtomic { state . sequence (| state | { state . repeat (| state | super :: visible :: WHITESPACE (state)) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: visible :: COMMENT (state) . and_then (| state | { state . repeat (| state | super :: visible :: WHITESPACE (state)) }) }) }) }) }) } else { Ok (state) } } } pub mod visible { use super :: super :: Rule ; # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_rules (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#SOI (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#grammar_doc (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#grammar_doc (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#grammar_rule (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#grammar_rule (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#EOI (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_rule (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#grammar_rule , | state | { state . sequence (| state | { self :: r#identifier (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#assignment_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#modifier (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_brace (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) . or_else (| state | { self :: r#line_doc (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#assignment_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#assignment_operator , | state | { state . match_string ("=") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_brace (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_brace , | state | { state . match_string ("{") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_brace (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_brace , | state | { state . match_string ("}") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_paren (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_paren , | state | { state . match_string ("(") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_paren (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_paren , | state | { state . match_string (")") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_brack (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_brack , | state | { state . match_string ("[") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_brack (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_brack , | state | { state . match_string ("]") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#silent_modifier (state) . or_else (| state | { self :: r#atomic_modifier (state) }) . or_else (| state | { self :: r#compound_atomic_modifier (state) }) . or_else (| state | { self :: r#non_atomic_modifier (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#silent_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#silent_modifier , | state | { state . match_string ("_") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#atomic_modifier , | state | { state . match_string ("@") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#compound_atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#compound_atomic_modifier , | state | { state . match_string ("$") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#non_atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#non_atomic_modifier , | state | { state . match_string ("!") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#tag_id (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#tag_id , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("#") . and_then (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha (state) }) }) . and_then (| state | { state . repeat (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha_num (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#node_tag (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#tag_id (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#assignment_operator (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#expression (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#expression , | state | { state . sequence (| state | { state . optional (| state | { self :: r#choice_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { state . sequence (| state | { self :: r#infix_operator (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { state . sequence (| state | { self :: r#infix_operator (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) }) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#term (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#term , | state | { state . sequence (| state | { state . optional (| state | { self :: r#node_tag (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#prefix_operator (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#prefix_operator (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#node (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#postfix_operator (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#postfix_operator (state) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#node (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#opening_paren (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_paren (state) }) }) . or_else (| state | { self :: r#terminal (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#terminal (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#_push (state) . or_else (| state | { self :: r#peek_slice (state) }) . or_else (| state | { self :: r#identifier (state) }) . or_else (| state | { self :: r#string (state) }) . or_else (| state | { self :: r#insensitive_string (state) }) . or_else (| state | { self :: r#range (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#prefix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#positive_predicate_operator (state) . or_else (| state | { self :: r#negative_predicate_operator (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#infix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#sequence_operator (state) . or_else (| state | { self :: r#choice_operator (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#postfix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#optional_operator (state) . or_else (| state | { self :: r#repeat_operator (state) }) . or_else (| state | { self :: r#repeat_once_operator (state) }) . or_else (| state | { self :: r#repeat_exact (state) }) . or_else (| state | { self :: r#repeat_min (state) }) . or_else (| state | { self :: r#repeat_max (state) }) . or_else (| state | { self :: r#repeat_min_max (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#positive_predicate_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#positive_predicate_operator , | state | { state . match_string ("&") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#negative_predicate_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#negative_predicate_operator , | state | { state . match_string ("!") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#sequence_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#sequence_operator , | state | { state . match_string ("~") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#choice_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#choice_operator , | state | { state . match_string ("|") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#optional_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#optional_operator , | state | { state . match_string ("?") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_operator , | state | { state . match_string ("*") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_once_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_once_operator , | state | { state . match_string ("+") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_exact (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_exact , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_min (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_min , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_max (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_max , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_min_max (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_min_max , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#number (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#number , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_range ('0' .. '9') . and_then (| state | { state . repeat (| state | { state . match_range ('0' .. '9') }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#integer (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#integer , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#number (state) . or_else (| state | { state . sequence (| state | { state . match_string ("-") . and_then (| state | { state . repeat (| state | { state . match_string ("0") }) }) . and_then (| state | { state . match_range ('1' .. '9') }) . and_then (| state | { state . optional (| state | { self :: r#number (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#comma (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#comma , | state | { state . match_string (",") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#_push (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#_push , | state | { state . sequence (| state | { state . match_string ("PUSH") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_paren (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_paren (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#peek_slice (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#peek_slice , | state | { state . sequence (| state | { state . match_string ("PEEK") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_brack (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#integer (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#range_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#integer (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brack (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#identifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#identifier , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("PUSH") }) . and_then (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha (state) }) }) . and_then (| state | { state . repeat (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha_num (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#alpha (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_range ('a' .. 'z') . or_else (| state | { state . match_range ('A' .. 'Z') }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#alpha_num (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#alpha (state) . or_else (| state | { state . match_range ('0' .. '9') }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#string (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#string , | state | { state . sequence (| state | { self :: r#quote (state) . and_then (| state | { self :: r#inner_str (state) }) . and_then (| state | { self :: r#quote (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#insensitive_string (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#insensitive_string , | state | { state . sequence (| state | { state . match_string ("^") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#string (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#range (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#range , | state | { state . sequence (| state | { self :: r#character (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#range_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#character (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#character (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#character , | state | { state . sequence (| state | { self :: r#single_quote (state) . and_then (| state | { self :: r#inner_chr (state) }) . and_then (| state | { self :: r#single_quote (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_str (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_str , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { let strings = ["\"" , "\\"] ; state . skip_until (& strings) . and_then (| state | { state . optional (| state | { state . sequence (| state | { self :: r#escape (state) . and_then (| state | { self :: r#inner_str (state) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_chr (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_chr , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#escape (state) . or_else (| state | { self :: r#ANY (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#escape (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#escape , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("\\") . and_then (| state | { state . match_string ("\"") . or_else (| state | { state . match_string ("\\") }) . or_else (| state | { state . match_string ("r") }) . or_else (| state | { state . match_string ("n") }) . or_else (| state | { state . match_string ("t") }) . or_else (| state | { state . match_string ("0") }) . or_else (| state | { state . match_string ("'") }) . or_else (| state | { self :: r#code (state) }) . or_else (| state | { self :: r#unicode (state) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#code (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#code , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("x") . and_then (| state | { self :: r#hex_digit (state) }) . and_then (| state | { self :: r#hex_digit (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#unicode (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#unicode , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("u") . and_then (| state | { self :: r#opening_brace (state) }) . and_then (| state | { state . sequence (| state | { self :: r#hex_digit (state) . and_then (| state | { self :: r#hex_digit (state) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) }) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#hex_digit (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#hex_digit , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . match_range ('0' .. '9') . or_else (| state | { state . match_range ('a' .. 'f') }) . or_else (| state | { state . match_range ('A' .. 'F') }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#quote (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#quote , | state | { state . match_string ("\"") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#single_quote (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#single_quote , | state | { state . match_string ("'") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#range_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#range_operator , | state | { state . match_string ("..") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#newline (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_string ("\n") . or_else (| state | { state . match_string ("\r\n") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#WHITESPACE (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . match_string (" ") . or_else (| state | { state . match_string ("\t") }) . or_else (| state | { self :: r#newline (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#line_comment (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { state . match_string ("//") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . lookahead (false , | state | { state . match_string ("/") . or_else (| state | { state . match_string ("!") }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { state . sequence (| state | { state . lookahead (false , | state | { self :: r#newline (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { state . sequence (| state | { state . lookahead (false , | state | { self :: r#newline (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#block_comment (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { state . match_string ("/*") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#block_comment (state) . or_else (| state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("*/") }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#block_comment (state) . or_else (| state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("*/") }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . match_string ("*/") }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#COMMENT (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#block_comment (state) . or_else (| state | { self :: r#line_comment (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#space (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_string (" ") . or_else (| state | { state . match_string ("\t") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#grammar_doc , | state | { state . sequence (| state | { state . match_string ("//!") . and_then (| state | { state . optional (| state | { self :: r#space (state) }) }) . and_then (| state | { self :: r#inner_doc (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#line_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#line_doc , | state | { state . sequence (| state | { state . match_string ("///") . and_then (| state | { state . optional (| state | { self :: r#space (state) }) }) . and_then (| state | { self :: r#inner_doc (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_doc , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . repeat (| state | { state . sequence (| state | { state . lookahead (false , | state | { self :: r#newline (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) }) }) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn ANY (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . skip (1) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn EOI (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: EOI , | state | state . end_of_input ()) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn SOI (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . start_of_input () } } pub use self :: visible :: * ; } :: pest :: state (input , | state | { match rule { Rule :: r#grammar_rules => rules :: r#grammar_rules (state) , Rule :: r#grammar_rule => rules :: r#grammar_rule (state) , Rule :: r#assignment_operator => rules :: r#assignment_operator (state) , Rule :: r#opening_brace => rules :: r#opening_brace (state) , Rule :: r#closing_brace => rules :: r#closing_brace (state) , Rule :: r#opening_paren => rules :: r#opening_paren (state) , Rule :: r#closing_paren => rules :: r#closing_paren (state) , Rule :: r#opening_brack => rules :: r#opening_brack (state) , Rule :: r#closing_brack => rules :: r#closing_brack (state) , Rule :: r#modifier => rules :: r#modifier (state) , Rule :: r#silent_modifier => rules :: r#silent_modifier (state) , Rule :: r#atomic_modifier => rules :: r#atomic_modifier (state) , Rule :: r#compound_atomic_modifier => rules :: r#compound_atomic_modifier (state) , Rule :: r#non_atomic_modifier => rules :: r#non_atomic_modifier (state) , Rule :: r#tag_id => rules :: r#tag_id (state) , Rule :: r#node_tag => rules :: r#node_tag (state) , Rule :: r#expression => rules :: r#expression (state) , Rule :: r#term => rules :: r#term (state) , Rule :: r#node => rules :: r#node (state) , Rule :: r#terminal => rules :: r#terminal (state) , Rule :: r#prefix_operator => rules :: r#prefix_operator (state) , Rule :: r#infix_operator => rules :: r#infix_operator (state) , Rule :: r#postfix_operator => rules :: r#postfix_operator (state) , Rule :: r#positive_predicate_operator => rules :: r#positive_predicate_operator (state) , Rule :: r#negative_predicate_operator => rules :: r#negative_predicate_operator (state) , Rule :: r#sequence_operator => rules :: r#sequence_operator (state) , Rule :: r#choice_operator => rules :: r#choice_operator (state) , Rule :: r#optional_operator => rules :: r#optional_operator (state) , Rule :: r#repeat_operator => rules :: r#repeat_operator (state) , Rule :: r#repeat_once_operator => rules :: r#repeat_once_operator (state) , Rule :: r#repeat_exact => rules :: r#repeat_exact (state) , Rule :: r#repeat_min => rules :: r#repeat_min (state) , Rule :: r#repeat_max => rules :: r#repeat_max (state) , Rule :: r#repeat_min_max => rules :: r#repeat_min_max (state) , Rule :: r#number => rules :: r#number (state) , Rule :: r#integer => rules :: r#integer (state) , Rule :: r#comma => rules :: r#comma (state) , Rule :: r#_push => rules :: r#_push (state) , Rule :: r#peek_slice => rules :: r#peek_slice (state) , Rule :: r#identifier => rules :: r#identifier (state) , Rule :: r#alpha => rules :: r#alpha (state) , Rule :: r#alpha_num => rules :: r#alpha_num (state) , Rule :: r#string => rules :: r#string (state) , Rule :: r#insensitive_string => rules :: r#insensitive_string (state) , Rule :: r#range => rules :: r#range (state) , Rule :: r#character => rules :: r#character (state) , Rule :: r#inner_str => rules :: r#inner_str (state) , Rule :: r#inner_chr => rules :: r#inner_chr (state) , Rule :: r#escape => rules :: r#escape (state) , Rule :: r#code => rules :: r#code (state) , Rule :: r#unicode => rules :: r#unicode (state) , Rule :: r#hex_digit => rules :: r#hex_digit (state) , Rule :: r#quote => rules :: r#quote (state) , Rule :: r#single_quote => rules :: r#single_quote (state) , Rule :: r#range_operator => rules :: r#range_operator (state) , Rule :: r#newline => rules :: r#newline (state) , Rule :: r#WHITESPACE => rules :: r#WHITESPACE (state) , Rule :: r#line_comment => rules :: r#line_comment (state) , Rule :: r#block_comment => rules :: r#block_comment (state) , Rule :: r#COMMENT => rules :: r#COMMENT (state) , Rule :: r#space => rules :: r#space (state) , Rule :: r#grammar_doc => rules :: r#grammar_doc (state) , Rule :: r#line_doc => rules :: r#line_doc (state) , Rule :: r#inner_doc => rules :: r#inner_doc (state) , Rule :: EOI => rules :: EOI (state) } }) } }
+# [doc = "Pest meta-grammar\n\n# Warning: Semantic Versioning\nThere may be non-breaking changes to the meta-grammar\nbetween minor versions. Those non-breaking changes, however,\nmay translate into semver-breaking changes due to the additional variants\nadded to the `Rule` enum. This is a known issue and will be fixed in the\nfuture (e.g. by increasing MSRV and non_exhaustive annotations)."] # [allow (dead_code , non_camel_case_types , clippy :: upper_case_acronyms)] # [derive (Clone , Copy , Debug , Eq , Hash , Ord , PartialEq , PartialOrd)] pub enum Rule { # [doc = "End-of-input"] EOI , # [doc = "The top-level rule of a grammar."] r#grammar_rules , # [doc = "A rule of a grammar."] r#grammar_rule , # [doc = "Assignment operator."] r#assignment_operator , # [doc = "Opening brace for a rule."] r#opening_brace , # [doc = "Closing brace for a rule."] r#closing_brace , # [doc = "Opening parenthesis for a branch, PUSH, etc."] r#opening_paren , # [doc = "Closing parenthesis for a branch, PUSH, etc."] r#closing_paren , # [doc = "Opening bracket for PEEK (slice inside)."] r#opening_brack , # [doc = "Closing bracket for PEEK (slice inside)."] r#closing_brack , # [doc = "A rule modifier."] r#modifier , # [doc = "Silent rule prefix."] r#silent_modifier , # [doc = "Atomic rule prefix."] r#atomic_modifier , # [doc = "Compound atomic rule prefix."] r#compound_atomic_modifier , # [doc = "Non-atomic rule prefix."] r#non_atomic_modifier , # [doc = "A tag label."] r#tag_id , # [doc = "For assigning labels to nodes."] r#node_tag , # [doc = "A rule expression."] r#expression , # [doc = "A rule term."] r#term , # [doc = "A rule node (inside terms)."] r#node , # [doc = "A terminal expression."] r#terminal , # [doc = "Possible predicates for a rule."] r#prefix_operator , # [doc = "Branches or sequences."] r#infix_operator , # [doc = "Possible modifiers for a rule."] r#postfix_operator , # [doc = "A positive predicate."] r#positive_predicate_operator , # [doc = "A negative predicate."] r#negative_predicate_operator , # [doc = "A sequence operator."] r#sequence_operator , # [doc = "A choice operator."] r#choice_operator , # [doc = "An optional operator."] r#optional_operator , # [doc = "A repeat operator."] r#repeat_operator , # [doc = "A repeat at least once operator."] r#repeat_once_operator , # [doc = "A repeat exact times."] r#repeat_exact , # [doc = "A repeat at least times."] r#repeat_min , # [doc = "A repeat at most times."] r#repeat_max , # [doc = "A repeat in a range."] r#repeat_min_max , # [doc = "A number."] r#number , # [doc = "An integer number (positive or negative)."] r#integer , # [doc = "A comma terminal."] r#comma , # [doc = "A PUSH expression."] r#_push , # [doc = "A PEEK expression."] r#peek_slice , # [doc = "An identifier."] r#identifier , # [doc = "An alpha character."] r#alpha , # [doc = "An alphanumeric character."] r#alpha_num , # [doc = "A string."] r#string , # [doc = "An insensitive string."] r#insensitive_string , # [doc = "A character range."] r#range , # [doc = "A single quoted character"] r#character , # [doc = "A quoted string."] r#inner_str , # [doc = "An escaped or any character."] r#inner_chr , # [doc = "An escape sequence."] r#escape , # [doc = "A hexadecimal code."] r#code , # [doc = "A unicode code."] r#unicode , # [doc = "A hexadecimal digit."] r#hex_digit , # [doc = "A double quote."] r#quote , # [doc = "A single quote."] r#single_quote , # [doc = "A range operator."] r#range_operator , # [doc = "A newline character."] r#newline , # [doc = "A whitespace character."] r#WHITESPACE , # [doc = "A single line comment."] r#line_comment , # [doc = "A multi-line comment."] r#block_comment , # [doc = "A grammar comment."] r#COMMENT , # [doc = "A space character."] r#space , # [doc = "A top-level comment."] r#grammar_doc , # [doc = "A rule comment."] r#line_doc , # [doc = "A comment content."] r#inner_doc } impl Rule { pub fn all_rules () -> & 'static [Rule] { & [Rule :: r#grammar_rules , Rule :: r#grammar_rule , Rule :: r#assignment_operator , Rule :: r#opening_brace , Rule :: r#closing_brace , Rule :: r#opening_paren , Rule :: r#closing_paren , Rule :: r#opening_brack , Rule :: r#closing_brack , Rule :: r#modifier , Rule :: r#silent_modifier , Rule :: r#atomic_modifier , Rule :: r#compound_atomic_modifier , Rule :: r#non_atomic_modifier , Rule :: r#tag_id , Rule :: r#node_tag , Rule :: r#expression , Rule :: r#term , Rule :: r#node , Rule :: r#terminal , Rule :: r#prefix_operator , Rule :: r#infix_operator , Rule :: r#postfix_operator , Rule :: r#positive_predicate_operator , Rule :: r#negative_predicate_operator , Rule :: r#sequence_operator , Rule :: r#choice_operator , Rule :: r#optional_operator , Rule :: r#repeat_operator , Rule :: r#repeat_once_operator , Rule :: r#repeat_exact , Rule :: r#repeat_min , Rule :: r#repeat_max , Rule :: r#repeat_min_max , Rule :: r#number , Rule :: r#integer , Rule :: r#comma , Rule :: r#_push , Rule :: r#peek_slice , Rule :: r#identifier , Rule :: r#alpha , Rule :: r#alpha_num , Rule :: r#string , Rule :: r#insensitive_string , Rule :: r#range , Rule :: r#character , Rule :: r#inner_str , Rule :: r#inner_chr , Rule :: r#escape , Rule :: r#code , Rule :: r#unicode , Rule :: r#hex_digit , Rule :: r#quote , Rule :: r#single_quote , Rule :: r#range_operator , Rule :: r#newline , Rule :: r#WHITESPACE , Rule :: r#line_comment , Rule :: r#block_comment , Rule :: r#COMMENT , Rule :: r#space , Rule :: r#grammar_doc , Rule :: r#line_doc , Rule :: r#inner_doc] } } # [allow (clippy :: all)] impl :: pest :: Parser < Rule > for PestParser { fn parse < 'i > (rule : Rule , input : & 'i str) -> :: std :: result :: Result < :: pest :: iterators :: Pairs < 'i , Rule > , :: pest :: error :: Error < Rule > > { mod rules { # ! [allow (clippy :: upper_case_acronyms)] pub mod hidden { use super :: super :: Rule ; # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn skip (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { if state . atomicity () == :: pest :: Atomicity :: NonAtomic { state . sequence (| state | { state . repeat (| state | super :: visible :: WHITESPACE (state)) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: visible :: COMMENT (state) . and_then (| state | { state . repeat (| state | super :: visible :: WHITESPACE (state)) }) }) }) }) }) } else { Ok (state) } } } pub mod visible { use super :: super :: Rule ; # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_rules (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#SOI (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#grammar_doc (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#grammar_doc (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#grammar_rule (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#grammar_rule (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#EOI (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_rule (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#grammar_rule , | state | { state . sequence (| state | { self :: r#identifier (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#assignment_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#modifier (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_brace (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) . or_else (| state | { self :: r#line_doc (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#assignment_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#assignment_operator , | state | { state . match_string ("=") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_brace (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_brace , | state | { state . match_string ("{") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_brace (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_brace , | state | { state . match_string ("}") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_paren (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_paren , | state | { state . match_string ("(") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_paren (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_paren , | state | { state . match_string (")") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#opening_brack (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#opening_brack , | state | { state . match_string ("[") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#closing_brack (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#closing_brack , | state | { state . match_string ("]") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#silent_modifier (state) . or_else (| state | { self :: r#atomic_modifier (state) }) . or_else (| state | { self :: r#compound_atomic_modifier (state) }) . or_else (| state | { self :: r#non_atomic_modifier (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#silent_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#silent_modifier , | state | { state . match_string ("_") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#atomic_modifier , | state | { state . match_string ("@") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#compound_atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#compound_atomic_modifier , | state | { state . match_string ("$") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#non_atomic_modifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#non_atomic_modifier , | state | { state . match_string ("!") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#tag_id (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#tag_id , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("#") . and_then (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha (state) }) }) . and_then (| state | { state . repeat (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha_num (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#node_tag (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#tag_id (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#assignment_operator (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#expression (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#expression , | state | { state . sequence (| state | { state . optional (| state | { self :: r#choice_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { state . sequence (| state | { self :: r#infix_operator (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { state . sequence (| state | { self :: r#infix_operator (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#term (state) }) }) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#term (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#term , | state | { state . sequence (| state | { state . optional (| state | { self :: r#node_tag (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#prefix_operator (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#prefix_operator (state) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#node (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#postfix_operator (state) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#postfix_operator (state) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#node (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { self :: r#opening_paren (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_paren (state) }) }) . or_else (| state | { self :: r#terminal (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#terminal (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#_push (state) . or_else (| state | { self :: r#peek_slice (state) }) . or_else (| state | { self :: r#identifier (state) }) . or_else (| state | { self :: r#string (state) }) . or_else (| state | { self :: r#insensitive_string (state) }) . or_else (| state | { self :: r#range (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#prefix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#positive_predicate_operator (state) . or_else (| state | { self :: r#negative_predicate_operator (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#infix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#sequence_operator (state) . or_else (| state | { self :: r#choice_operator (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#postfix_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#optional_operator (state) . or_else (| state | { self :: r#repeat_operator (state) }) . or_else (| state | { self :: r#repeat_once_operator (state) }) . or_else (| state | { self :: r#repeat_exact (state) }) . or_else (| state | { self :: r#repeat_min (state) }) . or_else (| state | { self :: r#repeat_max (state) }) . or_else (| state | { self :: r#repeat_min_max (state) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#positive_predicate_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#positive_predicate_operator , | state | { state . match_string ("&") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#negative_predicate_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#negative_predicate_operator , | state | { state . match_string ("!") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#sequence_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#sequence_operator , | state | { state . match_string ("~") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#choice_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#choice_operator , | state | { state . match_string ("|") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#optional_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#optional_operator , | state | { state . match_string ("?") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_operator , | state | { state . match_string ("*") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_once_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_once_operator , | state | { state . match_string ("+") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_exact (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_exact , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_min (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_min , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_max (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_max , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#repeat_min_max (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#repeat_min_max , | state | { state . sequence (| state | { self :: r#opening_brace (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#comma (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#number (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#number (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#number , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_range ('0' .. '9') . and_then (| state | { state . repeat (| state | { state . match_range ('0' .. '9') }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#integer (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#integer , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#number (state) . or_else (| state | { state . sequence (| state | { state . match_string ("-") . and_then (| state | { state . repeat (| state | { state . match_string ("0") }) }) . and_then (| state | { state . match_range ('1' .. '9') }) . and_then (| state | { state . optional (| state | { self :: r#number (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#comma (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#comma , | state | { state . match_string (",") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#_push (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#_push , | state | { state . sequence (| state | { state . match_string ("PUSH") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_paren (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#expression (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_paren (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#peek_slice (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#peek_slice , | state | { state . sequence (| state | { state . match_string ("PEEK") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#opening_brack (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#integer (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#range_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . optional (| state | { self :: r#integer (state) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#closing_brack (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#identifier (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#identifier , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("PUSH") }) . and_then (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha (state) }) }) . and_then (| state | { state . repeat (| state | { state . match_string ("_") . or_else (| state | { self :: r#alpha_num (state) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#alpha (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_range ('a' .. 'z') . or_else (| state | { state . match_range ('A' .. 'Z') }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#alpha_num (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { self :: r#alpha (state) . or_else (| state | { state . match_range ('0' .. '9') }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#string (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#string , | state | { state . sequence (| state | { self :: r#quote (state) . and_then (| state | { self :: r#inner_str (state) }) . and_then (| state | { self :: r#quote (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#insensitive_string (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#insensitive_string , | state | { state . sequence (| state | { state . match_string ("^") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#string (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#range (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#range , | state | { state . sequence (| state | { self :: r#character (state) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#range_operator (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#character (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#character (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#character , | state | { state . sequence (| state | { self :: r#single_quote (state) . and_then (| state | { self :: r#inner_chr (state) }) . and_then (| state | { self :: r#single_quote (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_str (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_str , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { let strings = ["\"" , "\\"] ; state . skip_until (& strings) . and_then (| state | { state . optional (| state | { state . sequence (| state | { self :: r#escape (state) . and_then (| state | { self :: r#inner_str (state) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_chr (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_chr , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#escape (state) . or_else (| state | { self :: r#ANY (state) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#escape (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#escape , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("\\") . and_then (| state | { state . match_string ("\"") . or_else (| state | { state . match_string ("\\") }) . or_else (| state | { state . match_string ("r") }) . or_else (| state | { state . match_string ("n") }) . or_else (| state | { state . match_string ("t") }) . or_else (| state | { state . match_string ("0") }) . or_else (| state | { state . match_string ("'") }) . or_else (| state | { self :: r#code (state) }) . or_else (| state | { self :: r#unicode (state) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#code (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#code , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("x") . and_then (| state | { self :: r#hex_digit (state) }) . and_then (| state | { self :: r#hex_digit (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#unicode (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#unicode , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . sequence (| state | { state . match_string ("u") . and_then (| state | { self :: r#opening_brace (state) }) . and_then (| state | { state . sequence (| state | { self :: r#hex_digit (state) . and_then (| state | { self :: r#hex_digit (state) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) . and_then (| state | { state . optional (| state | { self :: r#hex_digit (state) }) }) }) }) . and_then (| state | { self :: r#closing_brace (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#hex_digit (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#hex_digit , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . match_range ('0' .. '9') . or_else (| state | { state . match_range ('a' .. 'f') }) . or_else (| state | { state . match_range ('A' .. 'F') }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#quote (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#quote , | state | { state . match_string ("\"") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#single_quote (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#single_quote , | state | { state . match_string ("'") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#range_operator (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#range_operator , | state | { state . match_string ("..") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#newline (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_string ("\n") . or_else (| state | { state . match_string ("\r\n") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#WHITESPACE (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: Atomic , | state | { state . match_string (" ") . or_else (| state | { state . match_string ("\t") }) . or_else (| state | { self :: r#newline (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#line_comment (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { state . match_string ("//") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . lookahead (false , | state | { state . match_string ("/") . or_else (| state | { state . match_string ("!") }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { state . sequence (| state | { state . lookahead (false , | state | { self :: r#newline (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { state . sequence (| state | { state . lookahead (false , | state | { self :: r#newline (state) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) }) }) }) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#block_comment (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . sequence (| state | { state . match_string ("/*") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { self :: r#block_comment (state) . or_else (| state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("*/") }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { self :: r#block_comment (state) . or_else (| state | { state . sequence (| state | { state . lookahead (false , | state | { state . match_string ("*/") }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { self :: r#ANY (state) }) }) }) }) }) }) }) }) }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . match_string ("*/") }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#COMMENT (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: Atomic , | state | { self :: r#block_comment (state) . or_else (| state | { self :: r#line_comment (state) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#space (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . match_string (" ") . or_else (| state | { state . match_string ("\t") }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#grammar_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#grammar_doc , | state | { state . sequence (| state | { state . match_string ("//!") . and_then (| state | { state . optional (| state | { self :: r#space (state) }) }) . and_then (| state | { self :: r#inner_doc (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#line_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . atomic (:: pest :: Atomicity :: CompoundAtomic , | state | { state . rule (Rule :: r#line_doc , | state | { state . sequence (| state | { state . match_string ("///") . and_then (| state | { state . optional (| state | { self :: r#space (state) }) }) . and_then (| state | { self :: r#inner_doc (state) }) }) }) }) } # [inline] # [allow (non_snake_case , unused_variables)] pub fn r#inner_doc (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: r#inner_doc , | state | { state . atomic (:: pest :: Atomicity :: Atomic , | state | { let strings = ["\n" , "\r\n"] ; state . skip_until (& strings) }) }) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn ANY (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . skip (1) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn EOI (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . rule (Rule :: EOI , | state | state . end_of_input ()) } # [inline] # [allow (dead_code , non_snake_case , unused_variables)] pub fn SOI (state : :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >>) -> :: pest :: ParseResult < :: std :: boxed :: Box < :: pest :: ParserState < '_ , Rule >> > { state . start_of_input () } } pub use self :: visible :: * ; } :: pest :: state (input , | state | { match rule { Rule :: r#grammar_rules => rules :: r#grammar_rules (state) , Rule :: r#grammar_rule => rules :: r#grammar_rule (state) , Rule :: r#assignment_operator => rules :: r#assignment_operator (state) , Rule :: r#opening_brace => rules :: r#opening_brace (state) , Rule :: r#closing_brace => rules :: r#closing_brace (state) , Rule :: r#opening_paren => rules :: r#opening_paren (state) , Rule :: r#closing_paren => rules :: r#closing_paren (state) , Rule :: r#opening_brack => rules :: r#opening_brack (state) , Rule :: r#closing_brack => rules :: r#closing_brack (state) , Rule :: r#modifier => rules :: r#modifier (state) , Rule :: r#silent_modifier => rules :: r#silent_modifier (state) , Rule :: r#atomic_modifier => rules :: r#atomic_modifier (state) , Rule :: r#compound_atomic_modifier => rules :: r#compound_atomic_modifier (state) , Rule :: r#non_atomic_modifier => rules :: r#non_atomic_modifier (state) , Rule :: r#tag_id => rules :: r#tag_id (state) , Rule :: r#node_tag => rules :: r#node_tag (state) , Rule :: r#expression => rules :: r#expression (state) , Rule :: r#term => rules :: r#term (state) , Rule :: r#node => rules :: r#node (state) , Rule :: r#terminal => rules :: r#terminal (state) , Rule :: r#prefix_operator => rules :: r#prefix_operator (state) , Rule :: r#infix_operator => rules :: r#infix_operator (state) , Rule :: r#postfix_operator => rules :: r#postfix_operator (state) , Rule :: r#positive_predicate_operator => rules :: r#positive_predicate_operator (state) , Rule :: r#negative_predicate_operator => rules :: r#negative_predicate_operator (state) , Rule :: r#sequence_operator => rules :: r#sequence_operator (state) , Rule :: r#choice_operator => rules :: r#choice_operator (state) , Rule :: r#optional_operator => rules :: r#optional_operator (state) , Rule :: r#repeat_operator => rules :: r#repeat_operator (state) , Rule :: r#repeat_once_operator => rules :: r#repeat_once_operator (state) , Rule :: r#repeat_exact => rules :: r#repeat_exact (state) , Rule :: r#repeat_min => rules :: r#repeat_min (state) , Rule :: r#repeat_max => rules :: r#repeat_max (state) , Rule :: r#repeat_min_max => rules :: r#repeat_min_max (state) , Rule :: r#number => rules :: r#number (state) , Rule :: r#integer => rules :: r#integer (state) , Rule :: r#comma => rules :: r#comma (state) , Rule :: r#_push => rules :: r#_push (state) , Rule :: r#peek_slice => rules :: r#peek_slice (state) , Rule :: r#identifier => rules :: r#identifier (state) , Rule :: r#alpha => rules :: r#alpha (state) , Rule :: r#alpha_num => rules :: r#alpha_num (state) , Rule :: r#string => rules :: r#string (state) , Rule :: r#insensitive_string => rules :: r#insensitive_string (state) , Rule :: r#range => rules :: r#range (state) , Rule :: r#character => rules :: r#character (state) , Rule :: r#inner_str => rules :: r#inner_str (state) , Rule :: r#inner_chr => rules :: r#inner_chr (state) , Rule :: r#escape => rules :: r#escape (state) , Rule :: r#code => rules :: r#code (state) , Rule :: r#unicode => rules :: r#unicode (state) , Rule :: r#hex_digit => rules :: r#hex_digit (state) , Rule :: r#quote => rules :: r#quote (state) , Rule :: r#single_quote => rules :: r#single_quote (state) , Rule :: r#range_operator => rules :: r#range_operator (state) , Rule :: r#newline => rules :: r#newline (state) , Rule :: r#WHITESPACE => rules :: r#WHITESPACE (state) , Rule :: r#line_comment => rules :: r#line_comment (state) , Rule :: r#block_comment => rules :: r#block_comment (state) , Rule :: r#COMMENT => rules :: r#COMMENT (state) , Rule :: r#space => rules :: r#space (state) , Rule :: r#grammar_doc => rules :: r#grammar_doc (state) , Rule :: r#line_doc => rules :: r#line_doc (state) , Rule :: r#inner_doc => rules :: r#inner_doc (state) , Rule :: EOI => rules :: EOI (state) } }) } }
diff --git a/crates/pest_meta/src/optimizer/mod.rs b/crates/pest_meta/src/optimizer/mod.rs
index e1cc263..b3bea51 100644
--- a/crates/pest_meta/src/optimizer/mod.rs
+++ b/crates/pest_meta/src/optimizer/mod.rs
@@ -30,10 +30,11 @@
/// Takes pest's ASTs and optimizes them
pub fn optimize(rules: Vec<Rule>) -> Vec<OptimizedRule> {
+ let map = to_hash_map(&rules);
let optimized: Vec<OptimizedRule> = rules
.into_iter()
.map(rotater::rotate)
- .map(skipper::skip)
+ .map(|rule| skipper::skip(rule, &map))
.map(unroller::unroll)
.map(concatenator::concatenate)
.map(factorizer::factor)
@@ -41,10 +42,10 @@
.map(rule_to_optimized_rule)
.collect();
- let rules = to_hash_map(&optimized);
+ let optimized_map = to_optimized_hash_map(&optimized);
optimized
.into_iter()
- .map(|rule| restorer::restore_on_err(rule, &rules))
+ .map(|rule| restorer::restore_on_err(rule, &optimized_map))
.collect()
}
@@ -87,12 +88,18 @@
}
}
-fn to_hash_map(rules: &[OptimizedRule]) -> HashMap<String, OptimizedExpr> {
- rules
- .iter()
- .map(|r| (r.name.clone(), r.expr.clone()))
- .collect()
+macro_rules! to_hash_map {
+ ($func_name:ident, $rule:ty, $expr:ty) => {
+ fn $func_name(rules: &[$rule]) -> HashMap<String, $expr> {
+ rules
+ .iter()
+ .map(|r| (r.name.clone(), r.expr.clone()))
+ .collect()
+ }
+ };
}
+to_hash_map!(to_hash_map, Rule, Expr);
+to_hash_map!(to_optimized_hash_map, OptimizedRule, OptimizedExpr);
/// The optimized version of the pest AST's `Rule`.
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -1041,6 +1048,37 @@
}
#[test]
+ fn inline_skip() {
+ use crate::ast::Expr::*;
+ let rules = vec![
+ Rule {
+ name: "inline".to_owned(),
+ ty: RuleType::Atomic,
+ expr: Str("a".to_owned()),
+ },
+ Rule {
+ name: "skip".to_owned(),
+ ty: RuleType::Atomic,
+ expr: box_tree!(Rep(Seq(
+ NegPred(Choice(
+ Ident(String::from("inline")),
+ Str(String::from("b"))
+ )),
+ Ident("ANY".to_owned())
+ ))),
+ },
+ ];
+ let map = to_hash_map(&rules);
+ let rule = skipper::skip(rules[1].clone(), &map);
+ assert!(matches!(rule, Rule { expr: Skip(..), .. }));
+ let choices = match rule.expr {
+ Skip(choices) => choices,
+ _ => unreachable!(),
+ };
+ assert_eq!(choices, vec!["a".to_owned(), "b".to_owned()]);
+ }
+
+ #[test]
fn push() {
assert_eq!(
OptimizedExpr::Push(Box::new(OptimizedExpr::Ident("e".to_owned()))).to_string(),
diff --git a/crates/pest_meta/src/optimizer/restorer.rs b/crates/pest_meta/src/optimizer/restorer.rs
index e128e03..47c28ed 100644
--- a/crates/pest_meta/src/optimizer/restorer.rs
+++ b/crates/pest_meta/src/optimizer/restorer.rs
@@ -103,7 +103,7 @@
}];
assert_eq!(
- restore_on_err(rules[0].clone(), &to_hash_map(&rules)),
+ restore_on_err(rules[0].clone(), &to_optimized_hash_map(&rules)),
rules[0].clone()
);
}
@@ -123,7 +123,7 @@
};
assert_eq!(
- restore_on_err(rules[0].clone(), &to_hash_map(&rules)),
+ restore_on_err(rules[0].clone(), &to_optimized_hash_map(&rules)),
restored
);
}
@@ -146,7 +146,7 @@
};
assert_eq!(
- restore_on_err(rules[0].clone(), &to_hash_map(&rules)),
+ restore_on_err(rules[0].clone(), &to_optimized_hash_map(&rules)),
restored
);
}
diff --git a/crates/pest_meta/src/optimizer/skipper.rs b/crates/pest_meta/src/optimizer/skipper.rs
index 8300309..46033db 100644
--- a/crates/pest_meta/src/optimizer/skipper.rs
+++ b/crates/pest_meta/src/optimizer/skipper.rs
@@ -7,15 +7,32 @@
// option. All files in the project carrying such notice may not be copied,
// modified, or distributed except according to those terms.
+use std::collections::HashMap;
+
use crate::ast::*;
-pub fn skip(rule: Rule) -> Rule {
- fn populate_choices(expr: Expr, mut choices: Vec<String>) -> Option<Expr> {
+pub fn skip(rule: Rule, map: &HashMap<String, Expr>) -> Rule {
+ fn populate_choices(
+ expr: Expr,
+ map: &HashMap<String, Expr>,
+ mut choices: Vec<String>,
+ ) -> Option<Expr> {
match expr {
Expr::Choice(lhs, rhs) => {
if let Expr::Str(string) = *lhs {
choices.push(string);
- populate_choices(*rhs, choices)
+ populate_choices(*rhs, map, choices)
+ } else if let Expr::Ident(name) = *lhs {
+ // Try inlining rule in choices
+ if let Some(Expr::Skip(mut inlined_choices)) = map
+ .get(&name)
+ .and_then(|expr| populate_choices(expr.clone(), map, vec![]))
+ {
+ choices.append(&mut inlined_choices);
+ populate_choices(*rhs, map, choices)
+ } else {
+ None
+ }
} else {
None
}
@@ -24,6 +41,10 @@
choices.push(string);
Some(Expr::Skip(choices))
}
+ // Try inlining single rule
+ Expr::Ident(name) => map
+ .get(&name)
+ .and_then(|expr| populate_choices(expr.clone(), map, choices)),
_ => None,
}
}
@@ -38,7 +59,7 @@
if let Expr::Seq(lhs, rhs) = *expr {
if let (Expr::NegPred(expr), Expr::Ident(ident)) = (*lhs, *rhs) {
if ident == "ANY" {
- if let Some(expr) = populate_choices(*expr, vec![]) {
+ if let Some(expr) = populate_choices(*expr, map, vec![]) {
return expr;
}
}
diff --git a/crates/pest_meta/src/parser.rs b/crates/pest_meta/src/parser.rs
index c1768e3..2fb5631 100644
--- a/crates/pest_meta/src/parser.rs
+++ b/crates/pest_meta/src/parser.rs
@@ -20,6 +20,10 @@
use crate::ast::{Expr, Rule as AstRule, RuleType};
use crate::validator;
+/// Note: `include!` adds here a code generated from build.rs file.
+/// In case feature `not-bootstrap-in-src` is:
+/// * OFF -> include generated `grammar.rs` file from meta/src
+/// * ON -> include generated `__pest_grammar.rs` file from target/build/...
#[allow(missing_docs, unused_qualifications)]
mod grammar {
#[cfg(not(feature = "not-bootstrap-in-src"))]
@@ -29,6 +33,7 @@
include!(concat!(env!("OUT_DIR"), "/__pest_grammar.rs"));
}
+/// Import included grammar (`PestParser` class globally for current module).
pub use self::grammar::*;
/// A helper that will parse using the pest grammar
diff --git a/crates/pest_meta/src/validator.rs b/crates/pest_meta/src/validator.rs
index 16d3879..26ce300 100644
--- a/crates/pest_meta/src/validator.rs
+++ b/crates/pest_meta/src/validator.rs
@@ -226,6 +226,8 @@
errors.extend(validate_choices(rules));
errors.extend(validate_whitespace_comment(rules));
errors.extend(validate_left_recursion(rules));
+ #[cfg(feature = "grammar-extras")]
+ errors.extend(validate_tag_silent_rules(rules));
errors.sort_by_key(|error| match error.location {
InputLocation::Span(span) => span,
@@ -235,6 +237,78 @@
errors
}
+#[cfg(feature = "grammar-extras")]
+fn validate_tag_silent_rules<'a, 'i: 'a>(rules: &'a [ParserRule<'i>]) -> Vec<Error<Rule>> {
+ use crate::ast::RuleType;
+
+ fn to_type_hash_map<'a, 'i: 'a>(
+ rules: &'a [ParserRule<'i>],
+ ) -> HashMap<String, (&'a ParserNode<'i>, RuleType)> {
+ rules
+ .iter()
+ .map(|r| (r.name.clone(), (&r.node, r.ty)))
+ .collect()
+ }
+ let mut result = vec![];
+
+ fn check_silent_builtin<'a, 'i: 'a>(
+ expr: &ParserExpr<'i>,
+ rules_ref: &HashMap<String, (&'a ParserNode<'i>, RuleType)>,
+ span: Span<'a>,
+ ) -> Option<Error<Rule>> {
+ match &expr {
+ ParserExpr::Ident(rule_name) => {
+ let rule = rules_ref.get(rule_name);
+ if matches!(rule, Some((_, RuleType::Silent))) {
+ return Some(Error::<Rule>::new_from_span(
+ ErrorVariant::CustomError {
+ message: "tags on silent rules will not appear in the output"
+ .to_owned(),
+ },
+ span,
+ ));
+ } else if BUILTINS.contains(rule_name.as_str()) {
+ return Some(Error::new_from_span(
+ ErrorVariant::CustomError {
+ message: "tags on built-in rules will not appear in the output"
+ .to_owned(),
+ },
+ span,
+ ));
+ }
+ }
+ ParserExpr::Rep(node)
+ | ParserExpr::RepMinMax(node, _, _)
+ | ParserExpr::RepMax(node, _)
+ | ParserExpr::RepMin(node, _)
+ | ParserExpr::RepOnce(node)
+ | ParserExpr::RepExact(node, _)
+ | ParserExpr::Opt(node)
+ | ParserExpr::Push(node)
+ | ParserExpr::PosPred(node)
+ | ParserExpr::NegPred(node) => {
+ return check_silent_builtin(&node.expr, rules_ref, span);
+ }
+ _ => {}
+ };
+ None
+ }
+
+ let rules_map = to_type_hash_map(rules);
+ for rule in rules {
+ let rules_ref = &rules_map;
+ let mut errors = rule.node.clone().filter_map_top_down(|node1| {
+ if let ParserExpr::NodeTag(node2, _) = node1.expr {
+ check_silent_builtin(&node2.expr, rules_ref, node1.span)
+ } else {
+ None
+ }
+ });
+ result.append(&mut errors);
+ }
+ result
+}
+
/// Checks if `expr` is non-progressing, that is the expression does not
/// consume any input or any stack. This includes expressions matching the empty input,
/// `SOI` and ̀ `EOI`, predicates and repetitions.
@@ -593,7 +667,13 @@
None
}
ParserExpr::Seq(ref lhs, ref rhs) => {
- if is_non_failing(&lhs.expr, rules, &mut vec![trace.last().unwrap().clone()]) {
+ if is_non_failing(&lhs.expr, rules, &mut vec![trace.last().unwrap().clone()])
+ || is_non_progressing(
+ &lhs.expr,
+ rules,
+ &mut vec![trace.last().unwrap().clone()],
+ )
+ {
check_expr(rhs, rules, trace)
} else {
check_expr(lhs, rules, trace)
@@ -1737,6 +1817,22 @@
#[test]
#[should_panic(expected = "grammar error
+ --> 1:14
+ |
+1 | a = { !\"a\" ~ a }
+ | ^
+ |
+ = rule a is left-recursive (a -> a); pest::pratt_parser might be useful in this case")]
+ fn non_progressing_left_recursion() {
+ let input = "a = { !\"a\" ~ a }";
+ unwrap_or_report(consume_rules(
+ PestParser::parse(Rule::grammar_rules, input).unwrap(),
+ ));
+ }
+
+ #[test]
+ #[should_panic(expected = "grammar error
+
--> 1:7
|
1 | a = { \"a\"* | \"a\" | \"b\" }
@@ -1796,4 +1892,47 @@
PestParser::parse(Rule::grammar_rules, input).unwrap(),
));
}
+
+ #[test]
+ #[should_panic(expected = "grammar error
+
+ --> 1:7
+ |
+1 | a = { #b = b } b = _{ ASCII_DIGIT+ }
+ | ^----^
+ |
+ = tags on silent rules will not appear in the output")]
+ #[cfg(feature = "grammar-extras")]
+ fn tag_on_silent_rule() {
+ let input = "a = { #b = b } b = _{ ASCII_DIGIT+ }";
+ unwrap_or_report(consume_rules(
+ PestParser::parse(Rule::grammar_rules, input).unwrap(),
+ ));
+ }
+
+ #[test]
+ #[should_panic(expected = "grammar error
+
+ --> 1:7
+ |
+1 | a = { #b = ASCII_DIGIT+ }
+ | ^---------------^
+ |
+ = tags on built-in rules will not appear in the output")]
+ #[cfg(feature = "grammar-extras")]
+ fn tag_on_builtin_rule() {
+ let input = "a = { #b = ASCII_DIGIT+ }";
+ unwrap_or_report(consume_rules(
+ PestParser::parse(Rule::grammar_rules, input).unwrap(),
+ ));
+ }
+
+ #[test]
+ #[cfg(feature = "grammar-extras")]
+ fn tag_on_normal_rule() {
+ let input = "a = { #b = b } b = { ASCII_DIGIT+ }";
+ unwrap_or_report(consume_rules(
+ PestParser::parse(Rule::grammar_rules, input).unwrap(),
+ ));
+ }
}
diff --git a/crates/plotters-svg/.android-checksum.json b/crates/plotters-svg/.android-checksum.json
index f5f2cd4..3d9f156 100644
--- a/crates/plotters-svg/.android-checksum.json
+++ b/crates/plotters-svg/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"44d1884d1cf7a8ceae08a03e6f4f425d16da917032f644b2c21839ad75d3d35b","Android.bp":"d94294167fd456ec316105005b2b2c07e2eb4abfde0fc4967e14f7b095b7a862","Cargo.toml":"9387da863b0e5da2b032c4da78ea01b3d2d5231a8c9194ef8d3531b0b0de6e5f","LICENSE":"1c9a706701fabb4345eddbdf9e1b9b60668d05f9df8e0ec9bf4b6e08a15c4e33","METADATA":"775480ef3aebed6edfd89fdbcab3c7e8ed878bcd4fb393ca3d51017d5dcdacc0","MODULE_LICENSE_MIT":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"59f48d8839e1d7a7cd8cc4ee76102ed16b1fbd0429d2bf741263dd13d54f34fa","TEST_MAPPING":"5df47f5b5b7533d10aa6a3ecb9189615e716a8060f002faa2bf4c893c12f33f9","cargo_embargo.json":"aa45a963da01d3f018be316cd5b7646a5b413ce2611c5218f2914d2e8a9efd0e","src/lib.rs":"54c158634510d88191c150e7ad8246e3478c79a1f8b60349d0195a744ebc96ef","src/svg.rs":"c808366edf35f74857e9a89ac0e55f01ca6c809a4ce4ea725a032759d5f23414"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"5d327beced46102ee4a9c21d30385f27d8e9c81b3ac5d6b84aa76f42a526e55f","Android.bp":"3a60a655985855540bfa049329c90748ab35578030d7a9bb557ec98eb10769b5","Cargo.toml":"4681e5b00a03c2551cd4fd096787be07b15f8718d284a0cebe1f245d2d0ec23a","LICENSE":"1c9a706701fabb4345eddbdf9e1b9b60668d05f9df8e0ec9bf4b6e08a15c4e33","METADATA":"515252a15a2ab43523b4d6de4ce2e56742162f384aad93c959c730b222fb58fd","MODULE_LICENSE_MIT":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"59f48d8839e1d7a7cd8cc4ee76102ed16b1fbd0429d2bf741263dd13d54f34fa","TEST_MAPPING":"5df47f5b5b7533d10aa6a3ecb9189615e716a8060f002faa2bf4c893c12f33f9","cargo_embargo.json":"aa45a963da01d3f018be316cd5b7646a5b413ce2611c5218f2914d2e8a9efd0e","src/lib.rs":"54c158634510d88191c150e7ad8246e3478c79a1f8b60349d0195a744ebc96ef","src/svg.rs":"5f501e6217aca2af8c4835fa5db1a3653402049772233eea83c066ea0cea8ac7"}}
\ No newline at end of file
diff --git a/crates/plotters-svg/.cargo-checksum.json b/crates/plotters-svg/.cargo-checksum.json
index 6aaf347..0870d2a 100644
--- a/crates/plotters-svg/.cargo-checksum.json
+++ b/crates/plotters-svg/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"ba1b45b6791e3e6579282ccb15918ac3a3e78f1c87f40916b3e4542f60590555","LICENSE":"1e881ecf2862d01e6e5bc2b861e46886d2a6fb01499c0c508a209a7271b13cf2","README.md":"4e8a1eb3407b1e7366fa6cb5ebfbc87b9e64bf67fcdc2dcf775c1c6ccec04a2d","src/lib.rs":"a16cb6c509cf49213b2955815679bc33db413f5fc17263470d601eb23deb648a","src/svg.rs":"5b7188891265c25b5cc496f30ac2e7ecc50b9c27d4a4262c6621e7154376d46b"},"package":"38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab"}
\ No newline at end of file
+{"files":{"Cargo.toml":"a6b978fc90b5e12521bc9ba9ac0e439e648f58cd36136942a21952f06f809034","LICENSE":"1e881ecf2862d01e6e5bc2b861e46886d2a6fb01499c0c508a209a7271b13cf2","README.md":"4e8a1eb3407b1e7366fa6cb5ebfbc87b9e64bf67fcdc2dcf775c1c6ccec04a2d","src/lib.rs":"a16cb6c509cf49213b2955815679bc33db413f5fc17263470d601eb23deb648a","src/svg.rs":"c9e183bbc76ca675f2e4f7b9eeebaa10c245db96fe94faffba1ed75201dfce50"},"package":"51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"}
\ No newline at end of file
diff --git a/crates/plotters-svg/Android.bp b/crates/plotters-svg/Android.bp
index 1b24c16..125fd6e 100644
--- a/crates/plotters-svg/Android.bp
+++ b/crates/plotters-svg/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "plotters_svg",
cargo_env_compat: true,
- cargo_pkg_version: "0.3.5",
+ cargo_pkg_version: "0.3.7",
crate_root: "src/lib.rs",
edition: "2018",
rustlibs: ["libplotters_backend"],
diff --git a/crates/plotters-svg/Cargo.toml b/crates/plotters-svg/Cargo.toml
index e659289..8965ded 100644
--- a/crates/plotters-svg/Cargo.toml
+++ b/crates/plotters-svg/Cargo.toml
@@ -12,14 +12,23 @@
[package]
edition = "2018"
name = "plotters-svg"
-version = "0.3.5"
+version = "0.3.7"
authors = ["Hao Hou <[email protected]>"]
+build = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = "Plotters SVG backend"
homepage = "https://plotters-rs.github.io"
readme = "README.md"
license = "MIT"
repository = "https://github.com/plotters-rs/plotters.git"
+[lib]
+name = "plotters_svg"
+path = "src/lib.rs"
+
[dependencies.image]
version = "0.24.2"
features = [
@@ -31,7 +40,7 @@
default-features = false
[dependencies.plotters-backend]
-version = "0.3.5"
+version = "0.3.6"
[dev-dependencies]
diff --git a/crates/plotters-svg/METADATA b/crates/plotters-svg/METADATA
index 10b9f73..f193b5c 100644
--- a/crates/plotters-svg/METADATA
+++ b/crates/plotters-svg/METADATA
@@ -1,17 +1,17 @@
name: "plotters-svg"
description: "Plotters SVG backend"
third_party {
- version: "0.3.5"
+ version: "0.3.7"
license_type: NOTICE
last_upgrade_date {
- year: 2024
- month: 2
- day: 5
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/plotters-svg"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/plotters-svg/plotters-svg-0.3.5.crate"
- version: "0.3.5"
+ value: "https://static.crates.io/crates/plotters-svg/plotters-svg-0.3.7.crate"
+ version: "0.3.7"
}
}
diff --git a/crates/plotters-svg/src/svg.rs b/crates/plotters-svg/src/svg.rs
index 7ea105d..ec549f8 100644
--- a/crates/plotters-svg/src/svg.rs
+++ b/crates/plotters-svg/src/svg.rs
@@ -17,21 +17,16 @@
fn make_svg_color(color: BackendColor) -> String {
let (r, g, b) = color.rgb;
- return format!("#{:02X}{:02X}{:02X}", r, g, b);
+ format!("#{:02X}{:02X}{:02X}", r, g, b)
}
fn make_svg_opacity(color: BackendColor) -> String {
- return format!("{}", color.alpha);
+ format!("{}", color.alpha)
}
enum Target<'a> {
File(String, &'a Path),
Buffer(&'a mut String),
- // TODO: At this point we won't make the breaking change
- // so the u8 buffer is still supported. But in 0.3, we definitely
- // should get rid of this.
- #[cfg(feature = "deprecated_items")]
- U8Buffer(String, &'a mut Vec<u8>),
}
impl Target<'_> {
@@ -39,8 +34,6 @@
match self {
Target::File(ref mut buf, _) => buf,
Target::Buffer(buf) => buf,
- #[cfg(feature = "deprecated_items")]
- Target::U8Buffer(ref mut buf, _) => buf,
}
}
}
@@ -147,24 +140,6 @@
ret
}
- /// Create a new SVG drawing backend and store the document into a u8 vector
- #[cfg(feature = "deprecated_items")]
- #[deprecated(
- note = "This will be replaced by `with_string`, consider use `with_string` to avoid breaking change in the future"
- )]
- pub fn with_buffer(buf: &'a mut Vec<u8>, size: (u32, u32)) -> Self {
- let mut ret = Self {
- target: Target::U8Buffer(String::default(), buf),
- size,
- tag_stack: vec![],
- saved: false,
- };
-
- ret.init_svg_file(size);
-
- ret
- }
-
/// Create a new SVG drawing backend and store the document into a String buffer
pub fn with_string(buf: &'a mut String, size: (u32, u32)) -> Self {
let mut ret = Self {
@@ -203,11 +178,6 @@
.map_err(DrawingErrorKind::DrawingError)?;
}
Target::Buffer(_) => {}
- #[cfg(feature = "deprecated_items")]
- Target::U8Buffer(ref actual, ref mut target) => {
- target.clear();
- target.extend_from_slice(actual.as_bytes());
- }
}
self.saved = true;
}
@@ -481,11 +451,11 @@
}
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
- fn blit_bitmap<'b>(
+ fn blit_bitmap(
&mut self,
pos: BackendCoord,
(w, h): (u32, u32),
- src: &'b [u8],
+ src: &[u8],
) -> Result<(), DrawingErrorKind<Self::ErrorType>> {
use image::codecs::png::PngEncoder;
use image::ImageEncoder;
@@ -508,9 +478,7 @@
}
let padding = (3 - data.len() % 3) % 3;
- for _ in 0..padding {
- data.push(0);
- }
+ data.resize(data.len() + padding, 0);
let mut rem_bits = 0;
let mut rem_num = 0;
diff --git a/crates/predicates-core/.android-checksum.json b/crates/predicates-core/.android-checksum.json
index a874090..544e637 100644
--- a/crates/predicates-core/.android-checksum.json
+++ b/crates/predicates-core/.android-checksum.json
@@ -1 +1 @@
-{"package":null,"files":{".cargo-checksum.json":"47f259e249ca807a6e01a96a6cc13a71515da8659e2fe45eb73dc24586f2058c","Android.bp":"8cf92b542496d2f1b3457298e9528d599ff20d19ea092fcbedf80669eac02ec0","Cargo.toml":"857630d73eb1a78f3c41b213710f80b157ea6a9e96f76839e72f1819afae452c","LICENSE":"6a823c8069932f07af9f6632e29978de3af2c0d5ea8e71afc621547fb91edc29","LICENSE-APACHE":"6a823c8069932f07af9f6632e29978de3af2c0d5ea8e71afc621547fb91edc29","LICENSE-MIT":"b1d654eef14f674c63e128eacab0111ff6e9defc751341f764957f7947a25a7a","METADATA":"6a346728890caef7a848f4b4e83c6867ea71aaa638e755414243886862c8571f","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"46853d1c131cc303542ae362de9c52ec56b5c19b0db25a83d8bd1c1c033444fe","cargo_embargo.json":"48b90df621dbf12710f97f8c66bbe1682f5d0a9d4925ec8652ba6c52a7359ce5","src/core.rs":"cc9736f29d33c4ce26ad35d0fb9e5e1be50ca9e38922401e2ac25d5c024c2c0b","src/lib.rs":"fe280c52da66fa5969b5ae8bcd0623d1fb68e9046d8f543724b06aeaf0caf05c","src/reflection.rs":"3da6c0d415c0a773451b6c929dd39fa75f1729a042c82e324f4bd47edd7f0072"}}
\ No newline at end of file
+{"package":null,"files":{".cargo-checksum.json":"89e98c438f01215bee77445b2a364e119858ee78d67712ba9fa2fc9173b52fd1","Android.bp":"f97b3d46f212605bdef0b187500fc4a172d749fcd6e49c5f83f28ddcb533306b","Cargo.toml":"a9bf1f2ea1334f392b4be033afd8774895fb337c74d4207cb446b686a984dace","LICENSE":"90364369fcd32608226545dbeeff4401827c7305eabe4a022046cc03d078c9e9","LICENSE-APACHE":"90364369fcd32608226545dbeeff4401827c7305eabe4a022046cc03d078c9e9","LICENSE-MIT":"538f704e6bc384de6dd775d81e9df89f9d718f0e2808a24a789eaa03beb129d3","METADATA":"4114b5cdaa8c8f912b1ea6c3c3d14191b11e28dda58fc650dbc04720f327a2e1","MODULE_LICENSE_APACHE2":"0d6f8afa3940b7f06bebee651376d43bc8b0d5b437337be2696d30377451e93a","README.md":"46853d1c131cc303542ae362de9c52ec56b5c19b0db25a83d8bd1c1c033444fe","cargo_embargo.json":"48b90df621dbf12710f97f8c66bbe1682f5d0a9d4925ec8652ba6c52a7359ce5","src/core.rs":"cc9736f29d33c4ce26ad35d0fb9e5e1be50ca9e38922401e2ac25d5c024c2c0b","src/lib.rs":"67f7afbd21d27781ff07344731dd16ac912f4cc54dca2e80f39b5169a8f15096","src/reflection.rs":"616160257e93c40c7d7582dc3cde97adc6e5785a0d12fec9e34def63c1b7b7cc"}}
\ No newline at end of file
diff --git a/crates/predicates-core/.cargo-checksum.json b/crates/predicates-core/.cargo-checksum.json
index 60693ad..afea90b 100644
--- a/crates/predicates-core/.cargo-checksum.json
+++ b/crates/predicates-core/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"84010f585e2969b20c6a2876f28e2adc27286fe646cc5fef5f1a680bc4eb9794","LICENSE-APACHE":"a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9","LICENSE-MIT":"9d6bf646112f22f1dd5722fbf615ac184bc372727b615e5dff7e45fe8de3a99e","README.md":"86159502694c7d90efa5fb411b36c51fd212f57022a2541063f36c235d827098","src/core.rs":"19c28cbadf83f50a618fed6f378a03c53f1457bde8c2ba7f12ccd311747607b3","src/lib.rs":"7a3b59e6ae2a15d33ec65feb93202af008763b108a8ae1119dcb3cc2a2a86c94","src/reflection.rs":"6db20379c5530d4c7cda97d5532f9c0d6c4e6f8e9220e1a00b6bc6368a4ed491"},"package":"b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174"}
\ No newline at end of file
+{"files":{"Cargo.toml":"04d6bdedaeccd1b5536dc921680d11f7486da511555934d7bd7712a933c4709f","LICENSE-APACHE":"b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1","LICENSE-MIT":"6efb0476a1cc085077ed49357026d8c173bf33017278ef440f222fb9cbcb66e6","README.md":"86159502694c7d90efa5fb411b36c51fd212f57022a2541063f36c235d827098","src/core.rs":"19c28cbadf83f50a618fed6f378a03c53f1457bde8c2ba7f12ccd311747607b3","src/lib.rs":"bc35906f7e49e44e9188ebd2860dff2ab71fdd6beba306373a4e98ad53b59833","src/reflection.rs":"8c31410c0fa88a352e505dc9a748284994f223111d84f2aafda18b7ebd8fde9a"},"package":"727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"}
\ No newline at end of file
diff --git a/crates/predicates-core/Android.bp b/crates/predicates-core/Android.bp
index 72cd4a4..d66bd67 100644
--- a/crates/predicates-core/Android.bp
+++ b/crates/predicates-core/Android.bp
@@ -18,7 +18,7 @@
host_supported: true,
crate_name: "predicates_core",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.6",
+ cargo_pkg_version: "1.0.9",
crate_root: "src/lib.rs",
edition: "2021",
apex_available: [
diff --git a/crates/predicates-core/Cargo.toml b/crates/predicates-core/Cargo.toml
index a1de8f1..eeb0007 100644
--- a/crates/predicates-core/Cargo.toml
+++ b/crates/predicates-core/Cargo.toml
@@ -11,10 +11,11 @@
[package]
edition = "2021"
-rust-version = "1.64.0"
+rust-version = "1.74"
name = "predicates-core"
-version = "1.0.6"
+version = "1.0.9"
authors = ["Nick Stevens <[email protected]>"]
+build = false
include = [
"build.rs",
"src/**/*",
@@ -24,6 +25,11 @@
"benches/**/*",
"examples/**/*",
]
+autolib = false
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
description = "An API for boolean-valued predicate functions."
homepage = "https://github.com/assert-rs/predicates-rs/tree/master/crates/core"
documentation = "https://docs.rs/predicates-core"
@@ -42,37 +48,48 @@
license = "MIT OR Apache-2.0"
repository = "https://github.com/assert-rs/predicates-rs/tree/master/crates/core"
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = [
+ "--cfg",
+ "docsrs",
+]
+
[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
-search = "Unreleased"
+min = 1
replace = "{{version}}"
-min = 1
+search = "Unreleased"
[[package.metadata.release.pre-release-replacements]]
-file = "CHANGELOG.md"
-search = '\.\.\.HEAD'
-replace = "...{{tag_name}}"
exactly = 1
+file = "CHANGELOG.md"
+replace = "...{{tag_name}}"
+search = '\.\.\.HEAD'
[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
-search = "ReleaseDate"
-replace = "{{date}}"
min = 1
+replace = "{{date}}"
+search = "ReleaseDate"
[[package.metadata.release.pre-release-replacements]]
+exactly = 1
file = "CHANGELOG.md"
-search = "<!-- next-header -->"
replace = """
<!-- next-header -->
## [Unreleased] - ReleaseDate
"""
-exactly = 1
+search = "<!-- next-header -->"
[[package.metadata.release.pre-release-replacements]]
+exactly = 1
file = "CHANGELOG.md"
-search = "<!-- next-url -->"
replace = """
<!-- next-url -->
[Unreleased]: https://github.com/assert-rs/predicates-rs/compare/{{tag_name}}...HEAD"""
-exactly = 1
+search = "<!-- next-url -->"
+
+[lib]
+name = "predicates_core"
+path = "src/lib.rs"
diff --git a/crates/predicates-core/LICENSE-APACHE b/crates/predicates-core/LICENSE-APACHE
index d9a10c0..8dada3e 100644
--- a/crates/predicates-core/LICENSE-APACHE
+++ b/crates/predicates-core/LICENSE-APACHE
@@ -174,3 +174,28 @@
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/crates/predicates-core/LICENSE-MIT b/crates/predicates-core/LICENSE-MIT
index 51e7743..a2d0108 100644
--- a/crates/predicates-core/LICENSE-MIT
+++ b/crates/predicates-core/LICENSE-MIT
@@ -1,7 +1,4 @@
-MIT License
-
-Copyright (c) 2017 Nick Stevens
-
+Copyright (c) Individual contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/crates/predicates-core/METADATA b/crates/predicates-core/METADATA
index 0373078..cfaf42c 100644
--- a/crates/predicates-core/METADATA
+++ b/crates/predicates-core/METADATA
@@ -1,17 +1,17 @@
name: "predicates-core"
description: "An API for boolean-valued predicate functions."
third_party {
- version: "1.0.6"
+ version: "1.0.9"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 11
- day: 6
+ year: 2025
+ month: 1
+ day: 14
}
homepage: "https://crates.io/crates/predicates-core"
identifier {
type: "Archive"
- value: "https://static.crates.io/crates/predicates-core/predicates-core-1.0.6.crate"
- version: "1.0.6"
+ value: "https://static.crates.io/crates/predicates-core/predicates-core-1.0.9.crate"
+ version: "1.0.9"
}
}
diff --git a/crates/predicates-core/src/lib.rs b/crates/predicates-core/src/lib.rs
index e0c9ace..16a8a63 100644
--- a/crates/predicates-core/src/lib.rs
+++ b/crates/predicates-core/src/lib.rs
@@ -19,6 +19,7 @@
//! configuration. See the examples for how this can work.
#![warn(missing_docs, missing_debug_implementations)]
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod core;
pub use crate::core::*;
diff --git a/crates/predicates-core/src/reflection.rs b/crates/predicates-core/src/reflection.rs
index 120d1bd..0525cd3 100644
--- a/crates/predicates-core/src/reflection.rs
+++ b/crates/predicates-core/src/reflection.rs
@@ -54,13 +54,13 @@
}
}
-impl<'a> fmt::Display for Parameter<'a> {
+impl fmt::Display for Parameter<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {}", self.0, self.1)
}
}
-impl<'a> fmt::Debug for Parameter<'a> {
+impl fmt::Debug for Parameter<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({:?}, {})", self.0, self.1)
}
@@ -86,13 +86,13 @@
}
}
-impl<'a> fmt::Display for Child<'a> {
+impl fmt::Display for Child<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {}", self.0, self.1)
}
}
-impl<'a> fmt::Debug for Child<'a> {
+impl fmt::Debug for Child<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({:?}, {})", self.0, self.1)
}
@@ -150,7 +150,7 @@
}
}
-impl<'a> fmt::Debug for Case<'a> {
+impl fmt::Debug for Case<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let predicate = if let Some(ref predicate) = self.predicate {
format!("Some({})", predicate)
diff --git a/pseudo_crate/Cargo.lock b/pseudo_crate/Cargo.lock
index 7bd5e9e..f3d7a7c 100644
--- a/pseudo_crate/Cargo.lock
+++ b/pseudo_crate/Cargo.lock
@@ -8,7 +8,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a72425af5ca5fea30463427958c9fdc07ac24e58d0edafb7cb14ebf7706f2350"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
]
[[package]]
@@ -18,7 +18,7 @@
checksum = "9e42f25ac5fa51f4188d14baf8f387a97dcd8639644b2f3df948bf5f6dd7d6fa"
dependencies = [
"bit_field",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"log",
]
@@ -122,7 +122,7 @@
"bindgen 0.69.5",
"bindgen-cli",
"bit_field",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"bitreader",
"bstr",
"buddy_system_allocator",
@@ -241,7 +241,7 @@
"inotify-sys",
"instant",
"intrusive-collections",
- "itertools 0.13.0",
+ "itertools 0.14.0",
"itoa",
"jni",
"jni-sys",
@@ -640,12 +640,9 @@
[[package]]
name = "argh_shared"
-version = "0.1.12"
+version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531"
-dependencies = [
- "serde",
-]
+checksum = "a464143cc82dedcdc3928737445362466b7674b5db4e2eb8e869846d6d84f4f6"
[[package]]
name = "arrayvec"
@@ -865,7 +862,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cexpr",
"clang-sys",
"lazy_static",
@@ -886,7 +883,7 @@
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
dependencies = [
"annotate-snippets",
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cexpr",
"clang-sys",
"itertools 0.12.1",
@@ -931,9 +928,9 @@
[[package]]
name = "bitflags"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be"
[[package]]
name = "bitreader"
@@ -991,9 +988,9 @@
[[package]]
name = "bytemuck"
-version = "1.20.0"
+version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a"
+checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
dependencies = [
"bytemuck_derive",
]
@@ -1745,7 +1742,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"bytemuck",
"drm-ffi",
"drm-fourcc",
@@ -1849,7 +1846,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74351c3392ea1ff6cd2628e0042d268ac2371cb613252ff383b6dfa50d22fa79"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libc",
]
@@ -2194,7 +2191,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45bf55ba6dd53ad0ac115046ff999c5324c283444ee6e0be82454c4e8eb2f36a"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"drm",
"drm-fourcc",
"gbm-sys",
@@ -2218,7 +2215,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c683a9f13de31432e6097131d5f385898c7f0635c0f392b9d0fa165063c8ac"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"log",
"managed",
@@ -2283,9 +2280,9 @@
[[package]]
name = "glob"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "googletest"
@@ -2326,7 +2323,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09831ec59b80be69e75d29cf36e16afbbe5fd1af9c1bf4689ad91c77db5aa6a6"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libc",
"nix 0.27.1",
]
@@ -2666,7 +2663,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"futures-core",
"inotify-sys",
"libc",
@@ -2761,9 +2758,9 @@
[[package]]
name = "itertools"
-version = "0.13.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
@@ -2859,7 +2856,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93edd9cd673087fa7518fd63ad6c87be2cd9b4e35034b1873f3e3258c018275b"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libbpf-sys",
"libc",
"vsprintf",
@@ -2924,7 +2921,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"libc",
]
@@ -3389,7 +3386,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"libc",
]
@@ -3400,7 +3397,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"cfg_aliases 0.1.1",
"libc",
@@ -3413,7 +3410,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"cfg_aliases 0.2.1",
"libc",
@@ -3421,9 +3418,9 @@
[[package]]
name = "no-panic"
-version = "0.1.32"
+version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13039f2e914d0c1b8674a6a63681cfb857c41f029920db505f850c36dee22df8"
+checksum = "8f7da86466fe446079286ef4b2f6d789755b610a9d85da8477633f734d2697e8"
dependencies = [
"proc-macro2 1.0.92",
"quote 1.0.37",
@@ -3620,7 +3617,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"foreign-types",
"libc",
@@ -3868,9 +3865,9 @@
[[package]]
name = "pest_meta"
-version = "2.7.6"
+version = "2.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d"
+checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea"
dependencies = [
"once_cell",
"pest",
@@ -3984,9 +3981,9 @@
[[package]]
name = "plotters-svg"
-version = "0.3.5"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab"
+checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
dependencies = [
"plotters-backend",
]
@@ -4062,9 +4059,9 @@
[[package]]
name = "predicates-core"
-version = "1.0.6"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174"
+checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"
[[package]]
name = "predicates-tree"
@@ -4482,7 +4479,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"fallible-iterator 0.2.0",
"fallible-streaming-iterator",
"hashlink",
@@ -4536,7 +4533,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"errno",
"libc",
"linux-raw-sys 0.4.14",
@@ -5572,7 +5569,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6679b7fc2f6d6d2ea2f67555ef3ed9d71d30c5021faf9193091a5192db7dc468"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"log",
"ptr_meta",
@@ -5599,7 +5596,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6d465de2c918779dafb769a5a4fe8d6e4fb7cc4cc6cb1a735f2f6ec68beea4"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"ptr_meta",
"uguid",
]
@@ -5788,7 +5785,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18d8b176d4d3e420685e964f87c25df5fdd5b26d7eb0d0e7c892d771f5b81035"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"cfg-if",
"libc",
"nix 0.27.1",
@@ -5888,7 +5885,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa40e09453618c7a927c08c5a990497a2954da7c2aaa6c65e0d4f0fc975f6114"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"log",
"zerocopy 0.7.35",
]
@@ -6152,7 +6149,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a4bab6d420ee4a609b63ef4d5f9b5d309c6b93a029fccab70f2594c0cb3ae"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags 2.7.0",
"downcast-rs",
"io-lifetimes",
"rustix",
diff --git a/pseudo_crate/Cargo.toml b/pseudo_crate/Cargo.toml
index 7b8277d..7a9a033 100644
--- a/pseudo_crate/Cargo.toml
+++ b/pseudo_crate/Cargo.toml
@@ -20,7 +20,7 @@
arc-swap = "=1.7.1"
argh = "=0.1.12"
argh_derive = "=0.1.12"
-argh_shared = "=0.1.12"
+argh_shared = "=0.1.13"
arrayvec = "=0.7.6"
ash = "=0.37.3"
async-stream = "=0.3.5"
@@ -37,11 +37,11 @@
bindgen = "=0.69.5"
bindgen-cli = "=0.69.5"
bit_field = "=0.10.2"
-bitflags = "=2.6.0"
+bitflags = "=2.7.0"
bitreader = "=0.3.11"
bstr = "=1.3.0"
buddy_system_allocator = "=0.11.0"
-bytemuck = "=1.20.0"
+bytemuck = "=1.21.0"
bytemuck_derive = "=1.8.0"
byteorder = "=1.5.0"
bytes = "=1.9.0"
@@ -129,7 +129,7 @@
gdbstub_arch = "=0.3.1"
getrandom = "=0.2.15"
glam = "=0.29.2"
-glob = "=0.3.1"
+glob = "=0.3.2"
googletest = "=0.11.0"
googletest_macro = "=0.13.0"
gpio-cdev = "=0.6.0"
@@ -156,7 +156,7 @@
inotify-sys = "=0.1.5"
instant = "=0.1.12"
intrusive-collections = "=0.9.7"
-itertools = "=0.13.0"
+itertools = "=0.14.0"
itoa = "=1.0.14"
jni = "=0.21.1"
jni-sys = "=0.3.0"
@@ -206,7 +206,7 @@
moveit = "=0.6.0"
named-lock = "=0.3.0"
nix = "=0.28.0"
-no-panic = "=0.1.32"
+no-panic = "=0.1.33"
nom = "=7.1.3"
num-bigint = "=0.4.4"
num-complex = "=0.4.6"
@@ -237,7 +237,7 @@
pest = "=2.7.15"
pest_derive = "=2.7.6"
pest_generator = "=2.7.6"
-pest_meta = "=2.7.6"
+pest_meta = "=2.7.15"
petgraph = "=0.6.5"
pin-project = "=1.1.3"
pin-project-internal = "=1.1.3"
@@ -247,11 +247,11 @@
pkcs8 = "=0.10.2"
plotters = "=0.3.5"
plotters-backend = "=0.3.7"
-plotters-svg = "=0.3.5"
+plotters-svg = "=0.3.7"
poll_token_derive = "=0.1.0"
ppv-lite86 = "=0.2.17"
predicates = "=3.0.4"
-predicates-core = "=1.0.6"
+predicates-core = "=1.0.9"
predicates-tree = "=1.0.9"
prettyplease = "=0.2.25"
proc-macro2 = "=1.0.92"