docs.rs
...The "Type", "Subtype" and "BaseFont" tags // are straight out of the PDF spec. // // The dictionary macro is a helper that allows complex // key-value relationships to be represented in a simpler // visual manner, similar to a match statement. // A dictionary is implemented as an IndexMap of Vec<u8>, and Object...
Crate
v0.47.0
2026-11-04
crates.io
...impl MyBehavior for MyBehaviorEnum { fn my_trait_method(&self) { match self { MyImplementorA(inner) => inner.my_trait_method(), MyImplementorB(inner) => inner.my_trait_method(), } } } Additional trait methods would be expanded accordingly, and additional enum variants would correspond to additional match arms in each method definition. It's easy to see how...
Crate
v0.3.13
2024-03-28
docs.rs
...Visitor>(&self, visitor: &mut V) -> ControlFlow<V::Break> { match self { Self::A() => {} Self::B(_1, _2) => { _1.visit(visitor)?; _2.visit(visitor)?; } Self::C { named } => { named.visit(visitor)?; } } ControlFlow::Continue(()) } } Some types may wish to call a corresponding method on the visitor: #[derive(Visit, VisitMut)] #[visit(with = "visit_expr")] enum...
Crate
v0.7.0
2026-11-09
crates.io
...mind the trailing newline! match rulelist("a = b / c\nc = *(d e)\n") { Ok(rules) => println!("{:#?}", rules), Err(error) => eprintln!("{}", error), } outputs [ Rule { name: "a", node: Alternatives( [ Rulename( "b", ), Rulename( "c", ), ], ), kind: Basic, }, Rule { name: "c", node: Repetition { repeat: Variable { min: None, max: None, }, node: Group( Concatenation( [ Rulename( "d", ), Rulename...
Crate
v0.13.0
2022-10-21
crates.io
...proc_macro::TokenStream, ) -> proc_macro::TokenStream { let config = match from_tokenstream::<Config>(&TokenStream::from(attr)) { Ok(c) => c, Err(err) => return err.to_compile_error().into(), }; ... } See the serde documentation for the full range of controls that can be applied to types and their members. Error Handling Errors indicate the...
Crate
v0.3.0
2026-07-20
salvo.rs
...i64, } #[handler] async fn me(depot: &mut Depot, res: &mut Response) { match depot.jwt_auth_state() { JwtAuthState::Authorized => { let data = depot.jwt_auth_data::<Claims>().unwrap(); res.render(Json(&data.claims)); } JwtAuthState::Unauthorized => res.render(StatusError::unauthorized()), JwtAuthState::Forbidden => res.render(StatusError::forbidden()), } } #[tokio::main] async fn main() { let auth...
Crate
v1.2.1
2026-11-17
docs.rs
...FromRadix10>(text: &[u8]) -> Option<(&[u8], I)> { match I::from_radix_10(text) { (_, 0) => None, (n, used) => Some((&text[used..], n)), } } This crate has more to offer! Check out the full documentation at docs.rs .
Crate
v3.1.1
2026-10-16
github.com
...The object file is compiled by [this script] https://github.com/bytecodealliance/wit-bindgen/blob/main/ci/rebuild-libwit-bindgen-cabi.sh ) and is verified in repository continuous integration that the checked-in versions match what CI produces.
Crate
v0.44.0
2025-12-05
crates.io
...The port is based on the public domain source file from JSR166 as of CVS revision 1.323 , and is jointly licensed under MIT and Apache 2.0 to match the Rust API guidelines . The Java source files are included under the jsr166/ subdirectory for easy reference. The port was...
Crate
v0.5.2
2024-11-19
github.com
...cargo make --profile mainnet build Verifying binary hash To verify that a deployed binary matches the source code, you may want to build it reproducibly and then verify that the SHA256 hash matches that of the deployed binary. The motivation behind this is to prevent malicious code from being deployed...
Crate
v1.3.0
2026-09-17
docs.rs
...fn compute_something(input: &foo::FooAtom) -> u32 { match *input { foo_atom!("foo") => 1, foo_atom!("bar") => 2, _ => 3, } }
Crate
v0.11.0
2026-08-21
docs.rs
...Support for computing multiple BLAKE2s hashes in parallel, matching the efficiency of BLAKE2sp. See the many module. Example use blake2s_simd::{blake2s, Params}; let expected = "08d6cad88075de8f192db097573d0e829411cd91eb6ec65e8fc16c017edfdb74"; let hash = blake2s(b"foo"); assert_eq!(expected, &hash.to_hex()); let hash = Params::new() .hash_length(16) .key(b"Squeamish Ossifrage") .personal(b...
Crate
v1.0.5
2026-08-20
docs.rs
...Result<Package, _> = serde_path_to_error::deserialize(jd); match result { Ok(_) => panic!("expected a type error"), Err(err) => { let path = err.path().to_string(); assert_eq!(path, "dependencies.serde.version"); } } } License Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state...
Crate
v0.1.20
2025-09-15
github.com
...fn macros() { // Existing let vec = js_path("$.values[?match(@, $.regex)]", &json)?; // New let q_ast: JpQuery = ::jsonpath_rust::json_query!($.values[?match(@, $.regex)]); } This allows for query strings to be created infallibly at compile time for applications where query strings will be static strings in source code. Limitations Of Compiled...
Crate
v1.0.13
2026-11-14
crates.io
...If we implemented such without caring about background tasks, then this implementation will not match with the tokio's original implementation. Features Serde Support ( serde feature flag) Worker and NodeJS Support Test Utilities
Crate
v0.4.5
2026-11-06
docs.rs
...InitState> I => BuilderField<I, T> } // matching on the type-level `InitState` enum by using `InitWit`. // `WITNESS` comes from the `HasTypeWitness` trait match I::WITNESS { // `te: TypeEq<FooInit, Init>` InitWit::InitW(te) => { te.map(HelperFn::NEW) //: TypeEq<BuilderField<I, T>, T> .to_right(maybe_init) } InitWit::UninitW(_) => else_(), } } // Emulates a type...
Crate
v1.15.2
2026-04-14
docs.rs
Implementation of Cookie storage and retrieval Provides an implementation for storing and retrieving Cookie s per the path and domain matching rules specified in RFC6265 . Features preserve_order - uses indexmap::IndexMap in lieu of HashMap internally, so cookies are maintained in insertion/creation order public_suffix - Add support for public...
Crate
v0.22.1
2026-02-16
crates.io
...let os = os_type::current_platform(); println!("Type: {:?}", os.os_type); println!("Version: {}", os.version); Or to provide different handling on different operating systems: match os_type::current_platform().os_type { os_type::OSType::OSX => { println!("This is probably an apple laptop!"); } os_type::OSType::Ubuntu => { println!("This is running...
Crate
v2.6.0
2022-09-29
crates.io
...These are situations where matching Rust's ownership and lifetime rules can get tricky. It doesn't make sense to use shared ownership with interior mutability (i.e. Rc<RefCell<T>> or Arc<Mutex<T>> ) nor borrowed references (ie &'a T or &'a mut T ) for structures. The cycles rule...
Crate
v0.2.9
2023-05-22
docs.rs
...It will individually compile each of the source files matching the glob pattern, expect them to fail to compile, and assert that the compiler's error message matches an adjacently named *.stderr file containing the expected output (same file name as the test except with a different extension). If it...
Crate
v1.0.125
2026-11-16