crates.io
...f64, } impl C { fn dbg_inner(&self) -> usize { dbg!(self.val_c); 3 } } impl Enum { delegate! { // transformed to // // ```rust // match self { // Enum::A(a) => a.dbg_inner(), // Enum::B(b) => { println!("i am b"); b }.dbg_inner(), // Enum::C { v: c } => { c }.dbg_inner(), // } // ``` to match self { Enum::A(a...
Crate
v0.13.5
2025-12-10
oluseun.dev
...let stream = stream! {
loop {
match consumer.recv().await {
Ok(Some(payload)) => {
yield Ok(
Event::default()
.event("broadcast")
.data(payload),
);
}
Ok(None) => break,
Err(error) => {
tracing::warn!("recv error: {:?}", error);
tokio::time::sleep(Duration::from_secs(1)).await;
}
}
}
};
Axum keeps the connection alive while the stream waits:
Sse::new(stream).keep...
Rust Walkthroughs
2026-09-30
~7 min read
rust-osdev.com
...Rust 1.96.0
Stabilizes new core::range types and core::assert_matches!/core::debug_assert_matches!.
WebAssembly targets now fail on undefined linker symbols by default instead of implicitly treating them as "env" imports.
Includes Cargo fixes for CVE-2026-5223 and CVE-2026-5222 for users of third...
Newsletters
2026-06-10
~4 min read
docs.rs
...If the dependency is not specified in the configuration, wasm-compose will search the configured search paths for a matching component file. If a component to satisfy the dependency cannot be found, it will remain as an instance import in the composed component; at least one dependency must be satisfied...
Crate
v0.263.0
2026-10-30
rust-lang.github.io
...The structs can be constructed, destructed, and participate in pattern matches.
Private fields on tuple structs will prevent the following behaviors:
• Private fields cannot be bound in patterns (both in irrefutable and refutable contexts, i.e. let and match statements).
• Private fields cannot be specified outside of the defining module...
RFC 1
RFC
2014-03-11
~5 min read
vinted.engineering
...Notice that it derives the Deserialize trait, meaning, it can be deserialized from JSON
warp::post() filter to accept only POST requests
warp::body::json() to read JSON payload
.and(..) filter to chain them together and ensure that a successful request must match all of the required filters
use serde...
Rust Walkthroughs
2021-12-15
~7 min read
tokio.rs
...Nested routers with fallbacks
Router::nest allows you to send all requests with a matching prefix to some
other router or service. However in 0.5 it wasn't possible for nested routers to
have their own fallbacks. In 0.6 that now works:
use axum::{Router, Json, http::StatusCode...
Project/Tooling Updates
2022-08-24
~4 min read
crates.io
...This can be particularly handy with match statements. /// A trait for managing 8-byte discriminators in a slab of bytes pub trait SplDiscriminate { /// The 8-byte discriminator as a `[u8; 8]` const SPL_DISCRIMINATOR: ArrayDiscriminator; /// The 8-byte discriminator as a slice (`&[u8]`) const SPL_DISCRIMINATOR_SLICE: &'static [u8] = Self...
Crate
v0.5.2
2026-03-23
doc.rust-lang.org
pub unsafe fn from_raw(ptr: *mut c_char) -> CString
...It should be noted that the length isn't just "recomputed," but that the recomputed length must match the original length from the CString::into_raw call. This means the CString::into_raw/from_raw methods should not be used when passing the string to C functions that can modify...
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
www.lpalmieri.com
...Expected range of matching incoming requests: == 1
Number of matched incoming requests: 0
Implementation Strategy
We have more than enough tests to give us feedback now - let's kick off the implementation work!
We will start with a naive approach:
Retrieve the newsletter issue details from the body of the...
Rust Walkthroughs
2021-08-04
~26 min read
rust-trends.com
...exact matches instead of semantic approximations, automatic .gitignore respect, and predictable behavior. You know exactly what it's searching.A Hacker News commenter pointed out this is still technically RAG, just using information retrieval techniques that have existed for decades. Sometimes proven approaches beat newer alternatives.I wrote a deeper...
Newsletters
2026-02-04
~4 min read
doc.rust-lang.org
pub fn try_lock_shared(&self) -> Result<(), TryLockError>
...Examples
use std::fs::{File, TryLockError};
fn main() -> std::io::Result<()> {
let f = File::open("foo.txt")?;
// Explicit handling of the WouldBlock error
match f.try_lock_shared() {
Ok(_) => (),
Err(TryLockError::WouldBlock) => (), // Lock not acquired
Err(TryLockError::Error(err)) => return Err(err),
}
// Alternately, propagate the error as an io::Error...
method
std
Stable since 1.89.0
Version 1.100.0-nightly
belkadan.com
...But to take a whole block of code, and replace everything that looks like a message lock in that block…well, it might be possible with pattern-matching and quite a bit of recursion, but it’s going to be a lot easier to use procedural macros, a Rust macro...
Learn More Rust
2020-09-04
~16 min read
docs.rs
...Crate containers mirror the stable API of the matched Rust containers and forward to them as much as possible. TiSlice and TiVec can be easily converted to matched Rust containers and back using From , Into , AsRef and AsMut traits. Also, they expose raw property with the original data type. Containers...
Crate
v4.0.0-rc.1
2026-11-27
docs.rs
...extern crate udev; fn main() { let mut enumerator = udev::Enumerator::new().unwrap(); enumerator.match_subsystem("tty").unwrap(); for device in enumerator.scan_devices().unwrap() { println!("found device: {:?}", device.syspath()); } } Thread-safety The udev-api does not have any thread-safety guarantees, however many implementations are indeed thread-safe. If you...
Crate
v0.9.3
2025-01-23
doc.rust-lang.org
pub fn try_lock(&self) -> Result<(), TryLockError>
...Examples
use std::fs::{File, TryLockError};
fn main() -> std::io::Result<()> {
let f = File::create("foo.txt")?;
// Explicit handling of the WouldBlock error
match f.try_lock() {
Ok(_) => (),
Err(TryLockError::WouldBlock) => (), // Lock not acquired
Err(TryLockError::Error(err)) => return Err(err),
}
// Alternately, propagate the error as an io::Error
f...
method
std
Stable since 1.89.0
Version 1.100.0-nightly
erickt.github.io
...Token) -> Result<Foo, E> {
try!(d.expect_struct_start(token, "Foo"));
let mut a = None;
let mut b = None;
let mut c = None;
static FIELDS: &'static [&'static str] = &["a", "b", "c"];
loop {
let idx = match try!(d.expect_struct_field_or_end(FIELDS)) {
Some(idx) => idx,
None => { break; }
};
match idx...
Blog Posts
2014-12-15
~13 min read
sunshowers.io
...Some links:Video of the talk on YouTube.Slides on Google Slides.Repository with links and notes on GitHub.Coverage on Linux Weekly News.Introduction#Let’s start with a simple example – you decide to read from a channel in a loop and gather a bunch of messages:loop {
match...
Rust Walkthroughs
2025-10-08
~19 min read
mbuffett.com
...It’s
just unfortunate that I have to resort to “old-school” error-handling when I’m in a
filter:new_house_uuids = new_house_uuids
.into_iter()
.filter(|new_house_uuid| {
let existing_owner = db.investment_users.get(new_house_uuid);
match existing_owner {
Ok(Some(_)) | Err(_) => false,
Ok...
Call for Blog Posts
2020-09-23
~4 min read