docs.rs
...Example // This could be a cargo build script use rustc_version::{version, version_meta, Channel, Version}; fn main() { // Assert we haven't travelled back in time assert!(version().unwrap().major >= 1); // Set cfg flags depending on release channel match version_meta().unwrap().channel { Channel::Stable => { println!("cargo:rustc-cfg=RUSTC...
Crate
v0.4.1
2024-08-28
guillaumegomez.github.io
...Damn! It was a close call!!)
@MichaelNecio noted that shadowing never destroys a value.
@matklad simplified wording.
@withoutboats corrected the docs on str::trim_matches.
@kennytm fixed markdown formatting error of E0277, E0310 and E0502.
@ollie27 fixed rustdoc static and const generation of redirect pages and improved char::to_{lower...
New Crates & Project Updates
2016-06-20
~1 min read
www.shadaj.me
...tree_sitter::Node, source: &[u8]) -> Self {
#(#impl_body)*
match node.child(0).unwrap().kind() {
#(#match_cases),*,
_ => panic!()
}
}
}
}
An interesting trick appears when we handle the transform argument for leaf nodes, which allows users to define a closure that transforms the leaf string into a richer type. If we simply call...
Project/Tooling Updates
2022-08-17
~22 min read
docs.rs
...Exhaustive matches on the previous six-variant Value enum need either a Value::Tagged(_) arm or a call to Value::untag() / Value::untag_ref() before the match. YAML 1.2 strict booleans by default. country: NO stays "NO" (the YAML 1.2 fix to the "Norway problem") instead of becoming...
Crate
v0.0.13
2026-05-27
grpc.io
...The Tonic codegen interface will continue to be supported to allow users to
upgrade to the new transport implementation without needing to rewrite their
application.Going forward, you can expect the gRPC team to continue adding new features
and providing ongoing maintenance of the grpc crate, matching our other
supported...
Project/Tooling Updates
2026-05-27
~1 min read
thesquareplanet.com
...Pattern matching in Rust (think of it as a switch on steroids)
is checked for completeness (i.e., all possible cases are handled)
at compile-time.
4.1: Propagating Results with try! is a common pattern in Rust,
which would effectively provide exactly this kind of behavior.
9.1: Rust...
News & Blog Posts
2016-05-30
~16 min read
doc.rust-lang.org
pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering
...The interpretation of the signaling NaN bit follows the definition in the IEEE 754 standard, which may not match the interpretation by some of the older, non-conformant (e.g. MIPS) hardware implementations.
Example
struct GoodBoy {
name: String,
weight: f32,
}
let mut bois = vec![
GoodBoy { name: "Pucci".to_owned(), weight...
method
core
Stable since 1.62.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn total_cmp(&self, other: &Self) -> crate::cmp::Ordering
...The interpretation of the signaling NaN bit follows the definition in the IEEE 754 standard, which may not match the interpretation by some of the older, non-conformant (e.g. MIPS) hardware implementations.
Example
struct GoodBoy {
name: String,
weight: f64,
}
let mut bois = vec![
GoodBoy { name: "Pucci".to_owned(), weight...
method
core
Stable since 1.62.0
Version 1.100.0-nightly
rust-lang.github.io
...this:
match (self, other) {
(&Unknown(ref s1), &Unknown(ref s2)) => s1 == s2,
(&SuccessfulCompletion, &SuccessfulCompletion) => true,
(&Warning, &Warning) => true,
(&DynamicResultSetsReturned, &DynamicResultSetsReturned) => true,
(&ImplicitZeroBitPadding, &ImplicitZeroBitPadding) => true,
.
.
.
(_, _) => false
}
Even with optimisations enabled, this code is very suboptimal, producing this code. A way to extract the discriminant would allow this code:
match (self, other...
RFC 639
RFC
2015-01-21
~4 min read
seanmonstar.com
...The purpose of the roadmap is to map out what hyper looks like now, and exactly how it needs to change to match up with the VISION.
The roadmap starts by describing current known issues with hyper v0.14, after having spoken to many users.
Then, after using the tenets...
Observations/Thoughts
2022-04-06
~1 min read
docs.rs
...templates` dir in the crate root struct HelloTemplate<'a> { // the name of the struct can be anything name: &'a str, // the field name should match the variable name // in your template } fn main() { let hello = HelloTemplate { name: "world" }; // instantiate your struct println!("{}", hello.render().unwrap()); // then render it. } You should...
Crate
v0.16.1
2026-09-04
doc.rust-lang.org
pub const fn partition_point<P>(&self, pred: P) -> usize
...Examples
let v = [1, 2, 3, 3, 5, 6, 7];
let i = v.partition_point(|&x| x < 5);
assert_eq!(i, 4);
assert!(v[..i].iter().all(|&x| x < 5));
assert!(v[i..].iter().all(|&x| !(x < 5)));
If all elements of the slice match the predicate, including if the...
method
core
Stable since 1.52.0
Version 1.100.0-nightly
rust-lang.github.io
...the type for<'a> fn(Foo<'a>) is Copy for all user-defined types Foo, but there is no way to implement Clone, which is a supertrait of Copy, for it (an impl<T> Clone for fn(T) won't match against the higher-ranked type).
The MIR shims for...
RFC 2133
RFC
2017-08-28
~4 min read
siciarz.net
...pageviews") {
println!("Pageviews: {}", pageviews);
}
}
}
We're using the if let language construct which often simplifies pattern matches where we care for only one branch and do nothing if the expression doesn't match. However, at the moment it is hidden behind a feature gate, so you'll need to add...
Blog Posts
2014-12-08
~4 min read
askama.rs
...templates` dir in the crate root struct HelloTemplate<'a> { // the name of the struct can be anything name: &'a str, // the field name should match the variable name // in your template } fn main() { let hello = HelloTemplate { name: "world" }; // instantiate your struct println!("{}", hello.render().unwrap()); // then render it. } You should...
Crate
v0.16.1
2026-09-04
askama.rs
...templates` dir in the crate root struct HelloTemplate<'a> { // the name of the struct can be anything name: &'a str, // the field name should match the variable name // in your template } fn main() { let hello = HelloTemplate { name: "world" }; // instantiate your struct println!("{}", hello.render().unwrap()); // then render it. } You should...
Crate
v0.16.1
2026-09-04
insanitybit.github.io
...https://github.com/rust-lang/rust/issues/29723
fn main() {
let foo = String::from("FOO");
let foo = match 0 {
0 if {
some_func(foo) // foo is freed here
} => unreachable!(),
_ => {
// Use After Free - we return freed memory
foo
}
};
println!("{:#?}", foo); // And here we access the invalid memory
}
fn some_func(foo...
News & Blog Posts
2017-01-03
~4 min read
github.com
...templates` dir in the crate root struct HelloTemplate<'a> { // the name of the struct can be anything name: &'a str, // the field name should match the variable name // in your template } fn main() { let hello = HelloTemplate { name: "world" }; // instantiate your struct println!("{}", hello.render().unwrap()); // then render it. } You should...
Crate
v0.16.1
2026-09-04
purplesyringa.moe
...AstNode) -> String {
match node { .. }
}
fn dump(node: AstNode, fmt: &mut Formatter<'_>) {
match node { .. }
}
fn interpret(node: AstNode) -> Value {
match node { .. }
}
..
fn parse(code: &str) -> AstNode {
..
}
The second one is trait-based:struct Integer(i32);
struct Str(String);
struct Array(Vec<Box<dyn AstNode>>);
struct Add(Box<dyn AstNode>, Box<dyn...
Observations/Thoughts
2025-10-01
~16 min read