docs.rs
...The API version for the given message matching the version specified in the request header must be provided. use bytes::BytesMut; use kafka_protocol::messages::MetadataRequest; use kafka_protocol::protocol::Encodable; let mut bytes = BytesMut::new(); let request = MetadataRequest::default(); request.encode(&mut bytes, 12).unwrap(); Deserialization Messages can be...
Crate
v0.18.0
2026-08-20
docs.rs
...this is the generic case when we don't know about the input BufRead. // when the input is a &str or a &[u8], we don't actually need to use another // buffer, we could directly call `reader.read_event()` match reader.read_event_into(&mut buf) { Err(e) => panic!("Error...
Crate
v0.41.0
2026-06-29
crates.io
...This allows us to write custom preconditions for matching code. Let's make this more clear with a concrete example. Here is the declaration of an external extractor to match on the high-level instruction that defined a given operand Value , along with a new rule to sink loads into...
Crate
v0.123.14
2026-08-20
docs.rs
...cannot move out of borrowed content *self = match *self { // ^^^^^ cannot move out of borrowed content States::A(a) => States::B(a), States::B(a) => States::A(a), }; } } Depending on context this can be quite tricky to work around. With this crate, however: enum States { A(String), B(String), } impl States...
Crate
v0.1.8
2025-05-20
crates.io
...Linux, Windows, MacOS, FreeBSD, OpenBSD, illumos Example use mac_address::get_mac_address; fn main() { match get_mac_address() { Ok(Some(ma)) => { println!("MAC addr = {}", ma); println!("bytes = {:?}", ma.bytes()); } Ok(None) => println!("No MAC address found."), Err(e) => println!("{:?}", e), } } License mac_address is licensed under both MIT and...
Crate
v1.1.8
2025-02-10
neosmart.net
...ignore-result for rust Safely ignore errors in function return values when the result isn't critical This crate adds a .ignore() function to Result instances that ignores both the Ok and Err variants of the result, silencing compiler warnings about unused errors without needing to resort to empty match...
Crate
v0.2.0
2018-12-24
docs.rs
...extern crate http_range; use http_range::{HttpRange}; fn main() { let range_str = "bytes=0-8"; let size = 10; match HttpRange::parse(range_str, size) { Ok(rngs) => for r in rngs { println!("Start {}, length {}", r.start, r.length) }, Err(err) => println!("HttpRange parse error: {:?}", err) }; } Used in iron-send-file...
Crate
v0.1.5
2022-02-15
docs.rs
...Usage In libraries Libraries should link only to the log crate, and use the provided macros to log whatever information will be useful to downstream consumers: [dependencies] log = "0.4" use log::{info, trace, warn}; pub fn shave_the_yak(yak: &mut Yak) { trace!("Commencing yak shaving"); loop { match find...
Crate
v0.4.33
2026-06-20
docs.rs
Prefix trie (tree) datastructure (both a set and a map) that provides exact and longest-prefix matches. Prefix-Trie This crate provides prefix-map and prefix-set collections for IP prefixes and other fixed-width prefix types. PrefixMap is backed by a compact TreeBitMap-style trie and supports exact, longest...
Crate
v0.10.1
2026-07-24
github.com
...Example use ciborium_ll::{Decoder, Header}; use ciborium_io::Read as _; let input = b"\x6dHello, World!"; let mut decoder = Decoder::from(&input[..]); let mut chunks = 0; match decoder.pull().unwrap() { Header::Text(len) => { let mut segments = decoder.text(len); while let Some(mut segment) = segments.pull().unwrap() { let mut buffer...
Crate
v0.2.2
2024-01-24
durch.github.io
...String } let rsa_key = match RSAKey::from_pem("random_rsa_for_testing") { Ok(x) => x, Err(e) => panic!("{}", e) }; let jwt = Jwt::new(ExampleStruct{field: String::from("test")}, rsa_key, None); println!("{}", jwt); }
Crate
v0.9.0
2025-12-09
docs.rs
...Example let mut es = EventSource::get("http://localhost:8000/events"); while let Some(event) = es.next().await { match event { Ok(Event::Open) => println!("Connection Open!"), Ok(Event::Message(message)) => println!("Message: {:#?}", message), Err(err) => { println!("Error: {}", err); es.close(); } } } License: MIT OR Apache-2.0
Crate
v0.6.0
2024-03-29
docs.rs
...The version of prost used by the library is re-exported as tink_proto::prost , to allow library users to get a precise version match. Features The json feature enables serde_json based serialization of the structures. License Apache License, Version 2.0 Disclaimer This is not an officially supported...
Crate
v0.3.0
2024-11-28
docs.rs
...let len = BENCHMARKS.len(); } The compiler will require that the static element type matches with the element type of the distributed slice. If the two do not match, the program will not compile: #[distributed_slice(BENCHMARKS)] static BENCH_WTF: usize = 999; error[E0308]: mismatched types --> src/distributed_slice.rs:65...
Crate
v0.3.37
2026-07-18
docs.rs
...Deserializer<'de>, { UntaggedEnumVisitor::new() .bool(|b| match b { false => Ok(LinkTimeOptimization::ThinLocal), true => Ok(LinkTimeOptimization::Fat), }) .string(|string| match string { "fat" => Ok(LinkTimeOptimization::Fat), "thin" => Ok(LinkTimeOptimization::Thin), "off" => Ok(LinkTimeOptimization::Off), _ => Err(serde::de::Error::invalid_value( Unexpected::Str(string), &r#""fat" or "thin" or "off""#, )), }) .deserialize(deserializer) } } License...
Crate
v0.1.9
2025-09-14
docs.rs
...Install [dependencies] diff = "0.1" Example extern crate diff; fn main() { let left = "foo\nbar\nbaz\nquux"; let right = "foo\nbaz\nbar\nquux"; for diff in diff::lines(left, right) { match diff { diff::Result::Left(l) => println!("-{}", l), diff::Result::Both(l, _) => println!(" {}", l), diff::Result::Right(r) => println!("+{}", r...
Crate
v0.1.13
2022-06-29
crates.io
...Installation Select a version of kube along matching versions of k8s-openapi and schemars for Kubernetes structs and matching schemas. See also historical Kubernetes versions . [dependencies] kube = { version = "4.2.0", features = ["runtime", "derive"] } k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] } schemars = { version = "1" } See features for a...
Crate
v4.2.0
2026-07-22
crates.io
...Installation Select a version of kube along matching versions of k8s-openapi and schemars for Kubernetes structs and matching schemas. See also historical Kubernetes versions . [dependencies] kube = { version = "4.2.0", features = ["runtime", "derive"] } k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] } schemars = { version = "1" } See features for a...
Crate
v4.2.0
2026-07-22
crates.io
...Installation Select a version of kube along matching versions of k8s-openapi and schemars for Kubernetes structs and matching schemas. See also historical Kubernetes versions . [dependencies] kube = { version = "4.0.0", features = ["runtime", "derive"] } k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] } schemars = { version = "1" } See features for a...
Crate
v4.2.0
2026-07-22
crates.io
...Installation Select a version of kube along matching versions of k8s-openapi and schemars for Kubernetes structs and matching schemas. See also historical Kubernetes versions . [dependencies] kube = { version = "4.2.0", features = ["runtime", "derive"] } k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] } schemars = { version = "1" } See features for a...
Crate
v4.2.0
2026-07-22