docs.rs
...112,578 ns/iter (+/- 11,778) test match_u8::application_zip ... bench: 222 ns/iter (+/- 144) test match_u8::image_gif ... bench: 140 ns/iter (+/- 14) test match_u8::image_png ... bench: 139 ns/iter (+/- 18) test match_u8::text_plain ... bench: 44 ns/iter (+/- 3) However, it should be...
Crate
v3.2.2
2025-11-14
docs.rs
...The database can match a font using CSS-like queries. See Database::query . The database can try to load system fonts. Currently, this is implemented by scanning predefined directories. The library does not interact with the system API. Provides a unique ID for each font face. Non-goals Advanced font...
Crate
v0.24.0
2026-07-29
github.com
...use file_diff::{diff_files}; use std::fs::{File}; let mut file1 = match File::open("./src/lib.rs") { Ok(f) => f, Err(e) => panic!("{}", e), }; let mut file2 = match File::open("./src/lib.rs") { Ok(f) => f, Err(e) => panic!("{}", e), }; diff_files(&mut file1, &mut file2); The diff() function...
Crate
v1.0.0
2016-04-10
crates.io
...Example use urlpattern::UrlPattern; use urlpattern::UrlPatternInit; use urlpattern::UrlPatternMatchInput; fn main() { // Create the UrlPattern to match against. let init = UrlPatternInit { pathname: Some("/users/:id".to_owned()), ..Default::default() }; let pattern = <UrlPattern>::parse(init, Default::default()).unwrap(); // Match the pattern against a URL. let url = "https://example.com/users/123...
Crate
v0.6.0
2026-02-12
docs.rs
...Partial matching If you want to assert that one JSON value is "included" in another use assert_json_include : use assert_json_diff::assert_json_include; use serde_json::json; let a = json!({ "data": { "users": [ { "id": 1, "country": { "name": "Denmark" } }, { "id": 24, "country": { "name": "Denmark" } } ] } }); let b = json!({ "data": { "users...
Crate
v2.0.2
2022-06-29
docs.rs
CSS Selectors matching for Rust rust-selectors Documentation crates.io CSS Selectors library for Rust. Includes parsing and serialization of selectors, as well as matching against a generic tree of elements. Pseudo-elements and most pseudo-classes are generic as well. Warning: breaking changes are made to this library fairly...
Crate
v0.43.0
2026-11-11
crates.io
...How to get a compatible version of protoc The protoc binary that you use to generate code needs to have a version that exactly matches the version of the protobuf crate you are using. More specifically, if you are using Rust protobuf x.y.z then you need to use...
Crate
v4.36.2-release
2026-09-17
crates.io
...std::iter::Iterator<Item = <A as std::iter::Iterator>::Item>, { type Item = <A as std::iter::Iterator>::Item; fn next(&mut self) -> Option<Self::Item> { match self { Enum::A(x) => x.next(), Enum::B(x) => x.next(), } } fn size_hint(&self) -> (usize, Option<usize>) { match self { Enum::A(x) => x...
Crate
v0.16.0
2026-07-24
docs.rs
rapid fuzzy string matching library Rapid fuzzy string matching in Rust using the Levenshtein Distance Description • Installation • Usage • License Description RapidFuzz is a general purpose string matching library with implementations for Rust, C++ and Python. Key Features Diverse String Metrics : Offers a variety of string metrics to suit different use...
Crate
v0.5.0
2023-12-01
crates.io
...They're efficient and convenient for matching events or defining hardcoded keybindings. match key_event.into() { key!(ctrl-c) => { println!("Arg! You savagely killed me with a {}", fmt.to_string(key_event).red()); break; } key!(ctrl-q) => { println!("You typed {} which gracefully quits", fmt.to_string(key_event).green()); break...
Crate
v1.5.1
2026-10-17
github.com
...Vec<(&'static str, Value)>, encoder: &'a Encoder, ) -> FutureRecord<'a> { let subject_name_strategy = SubjectNameStrategy::TopicNameStrategy(topic, false); let payload = match encoder.encode(values, &subject_name_strategy) { Ok(v) => v, Err(e) => panic!("Error getting payload: {}", e), }; FutureRecord { topic, partition: None, payload: Some(&payload), key, timestamp: None, headers: None, } } fn get...
Crate
v6.0.0
2026-10-22
crates.io
...Catch-all variant Sometimes it is desirable to have an Other variant which holds the otherwise un-matched value as a field. The #[num_enum(catch_all)] attribute allows you to mark at most one variant for this purpose. The variant it's applied to must be a tuple variant...
Crate
v0.7.6
2026-03-15
crates.io
...Catch-all variant Sometimes it is desirable to have an Other variant which holds the otherwise un-matched value as a field. The #[num_enum(catch_all)] attribute allows you to mark at most one variant for this purpose. The variant it's applied to must be a tuple variant...
Crate
v0.7.6
2026-03-15
softprops.github.io
...Option<u64> } fn main() { match envy::from_env::<Config>() { Ok(config) => println!("{:#?}", config), Err(error) => panic!("{:#?}", error) } } ... export some environment variables $ FOO=8080 BAR=true BAZ=hello yourapp You should be able to access a completely typesafe config struct deserialized from env vars. Envy assumes an env var exists for...
Crate
v0.4.2
2021-01-04
crates.io
...a test my_test that accepts a path, and optionally the contents as input a directory to look for files (test fixtures) in a pattern to match files on datatest-stable will call the my_test function once per matching file in the directory. Directory traversals are recursive. datatest-stable...
Crate
v0.3.3
2026-03-31
sentry.io
...use sentry_log::LogFilter; let logger = sentry_log::SentryLogger::new().filter(|md| match md.level() { log::Level::Error => LogFilter::Event, _ => LogFilter::Ignore, }); Sending multiple items to Sentry To map a log record to multiple items in Sentry, you can combine multiple log filters using the bitwise or operator: use sentry...
Crate
v0.49.6
2026-11-16
crates.io
Generates random strings and byte strings matching a regex rand_regex Generates random strings and byte strings matching a regex. Examples use rand::{SeedableRng, Rng}; let mut rng = rand_xorshift::XorShiftRng::from_seed(*b"The initial seed"); // creates a generator for sampling strings let grx = rand_regex::Regex::compile(r...
Crate
v0.19.0
2026-02-24
solang.readthedocs.io
...function get() public view returns (bool) { return value; } } "#, 0).unwrap(); for part in &tree.0 { match part { SourceUnitPart::ContractDefinition(def) => { println!("found contract {:?}", def.name); for part in &def.parts { match part { ContractPart::VariableDefinition(def) => { println!("variable {:?}", def.name); } ContractPart::FunctionDefinition(def) => { println!("function {:?}", def.name); } _ => (), } } } _ => (), } }
Crate
v0.3.5
2025-06-22
docs.rs
...Parsing use svg::node::element::path::{Command, Data}; use svg::node::element::tag::Path; use svg::parser::Event; let path = "image.svg"; let mut content = String::new(); for event in svg::open(path, &mut content).unwrap() { match event { Event::Tag(Path, _, attributes) => { let data = attributes.get("d").unwrap(); let data...
Crate
v0.18.0
2024-09-27
crates.io
Glob-matched recursive file system walking. GlobWalk Recursively find files in a directory using globs. This crate is now in a perpetual maintnance mode and new users should probably cosider using glob . Comparison to the glob crate This crate was origially written years ago, when glob was a very differet...
Crate
v0.9.1
2024-01-06