blog.kolo.app
...It only has support for a limited number of types, which don't match Python's data types amazingly well.
Maybe it was time to try a different format. In particular, msgpack was looking attractive:
It is a binary format which optimises for size.
It supports many of the basic...
Rust Walkthroughs
2023-10-11
~8 min read
briankung.dev
...As mentioned before, not_whitespace will match any character that isn’t whitespace, whereas space1 will match a single space and space0 will match zero or one space.
But a few of these are custom parsers that I wrote from nom’s more basic building blocks: pinyin, jyutping, and definitions...
Rust Walkthroughs
2021-12-22
~11 min read
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.38
2026-11-09
doc.rust-lang.org
...algebraic data types, pattern matching, type inference, semicolon statement separation
• C++: references, RAII, smart pointers, move semantics, monomorphization, memory model
• ML Kit, Cyclone: region based memory management
• Haskell (GHC): typeclasses, type families
• Newsqueak, Alef, Limbo: channels, concurrency
• Erlang: message passing, thread failure, ,
• Swift: optional bindings
• Scheme: hygienic macros
• C#: attributes...
The Rust Reference
Book
2024-01-01
~1 min read
rocket.rs
...Routes without query parameters now match requests with or without query parameters. Default rankings prefer static paths and routes with query string matches. A native Accept header structure was added. The Accept request header can be retrieved via Request::accept(). All active routes can be retrieved via Rocket::routes(). Response...
News & Blog Posts
2017-07-18
~7 min read
siciarz.net
...extern crate postgres;
use postgres::{Connection, SslMode};
fn main() {
let dsn = "postgresql://rust:rust@localhost/rust";
let conn = match Connection::connect(dsn, &SslMode::None) {
Ok(conn) => conn,
Err(e) => {
println!("Connection error: {}", e);
return;
}
};
}
The Connection type has a few methods related to making queries; perhaps the simplest one is...
24 Days of Rust continues!
2014-12-15
~3 min read
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
doc.rust-lang.org
pub fn connect_addr(&self, socket_addr: &SocketAddr) -> io::Result<()>
...Examples
use std::os::unix::net::{UnixDatagram};
fn main() -> std::io::Result<()> {
let bound = UnixDatagram::bind("/path/to/socket")?;
let addr = bound.local_addr()?;
let sock = UnixDatagram::unbound()?;
match sock.connect_addr(&addr) {
Ok(sock) => sock,
Err(e) => {
println!("Couldn't connect: {e:?}");
return Err(e)
}
};
Ok(())
}
method
std
Stable since 1.70.0
Version 1.100.0-nightly
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.1
2026-11-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
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.1
2026-11-24
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
redox-os.org
...Redox was not matching POSIX behavior for file descriptors; when dup is called, the new fd should still refer to the same “file description”, which Redox did not have a concept of. I modified the kernel to match POSIX behavior.
I changed Redox’s target triple (for the gcc toolchain...
News & Blog Posts
2017-08-22
~4 min read
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.1
2026-11-24
doc.rust-lang.org
...Default,
{
match map.get_mut(&key) {
Some(value) => value,
None => {
map.insert(key.clone(), V::default());
map.get_mut(&key).unwrap()
}
}
}
Because of the lifetime restrictions imposed, &mut map's lifetime overlaps other mutable borrows, resulting in a compile error:
error[E0499]: cannot borrow `*map` as mutable more than once...
The Rustonomicon
Book
2024-01-01
~2 min read
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.1
2026-11-24
antoinerr.github.io
...match failing_function() {
Ok(s) => println!("{s}"),
Err(e) => match e.downcast_ref() {
Some(MyErrors::LetsFixThisTomorrowError) => (),
Some(MyErrors::ThisDoesntLookGoodError) => (),
Some(MyErrors::ImmaGetFiredError) => (),
None => (),
},
}
Returning early with an error
Finally, anyhow provides a utility macro to return early from your methods with an error: the bail! macro. Here is how it...
Rust Walkthroughs
2023-02-01
~6 min read
doc.rust-lang.org
pub fn contains<Q>(&self, value: &Q) -> bool
...The value may be any borrowed form of the set's value type, but Hash and Eq on the borrowed form must match those for the value type.
Examples
use std::collections::HashSet;
let set = HashSet::from([1, 2, 3]);
assert_eq!(set.contains(&1), true);
assert_eq!(set.contains...
method
std
Stable since 1.0.0
Version 1.100.0-nightly