crates.io
...When the specified expectations do not match the received request, mock.assert() fails the test with a detailed error description, including a diff that shows the differences between the expected and actual HTTP requests. Example: 0 of 1 expected requests matched the mock specification. Here is a comparison with the...
Crate
v0.9.0
2026-10-20
pid7.com
...If the needle is matched, the mask marks the position, allowing trailing_zeros / 8 to find the match index with zero
branching. This bitwise technique avoids branch mispredictions by turning conditional control into arithmetic.
Coined in 1996 by Hank Dietz and Randy Fisher at Purdue University, SWAR repurposes general-purpose...
Observations/Thoughts
2026-09-09
~4 min read
www.sea-ql.org
...513] Added the MATCH, -> and ->> operators for SQLite
use sea_query::extension::sqlite::SqliteBinOper;assert_eq!( Query::select() .column(Char::Character) .from(Char::Table) .and_where(Expr::col(Char::Character).binary(SqliteBinOper::Match, Expr::val("test"))) .build(SqliteQueryBuilder), ( r#"SELECT "character" FROM "character" WHERE "character" MATCH ?"#.to_owned(), Values(vec...
Project/Tooling Updates
2023-01-04
~3 min read
iev.ee
...i also added a \p{utf8} class that lets you constrain matches to valid UTF-8. rust's regex crate guarantees that matches only occur on valid UTF-8 boundaries, so how do you do that when your engine operates on raw bytes? you intersect (&) with the language of valid...
Observations/Thoughts
2026-03-11
~12 min read
blog.burntsushi.net
...option-ex-string-findfn main_find() {
let file_name = "foobar.rs";
match find(file_name, '.') {
None => println!("No file extension found."),
Some(i) => println!("File extension: {}", &file_name[i+1..]),
}
}
This code uses pattern
matching to do case
analysis on the Option<usize> returned by the find function. In fact...
Notable Links
2015-05-18
~57 min read
getcode.substack.com
...Let's try evaluating them by writing an interpreter.impl Expr {
fn eval(&self) -> i32 {
match self {
Expr::Lit(i) => *i,
Expr::Neg(r) => -r.eval(),
Expr::Add(r1, r2) => r1.eval() + r2.eval(),
}
}
}Easy enough - we pattern match on Expr and recursively call eval. Calling eval on the example...
Rust Walkthroughs
2023-03-29
~25 min read
doc.rust-lang.org
pub fn offset(&self) -> usize
...This means that, when the iterator has not been fully consumed, the returned value will match the index that will be returned by the next call to next().
Examples
let mut chars = "a楽".char_indices();
// `next()` has not been called yet, so `offset()` returns the byte
// index of the first...
method
core
Stable since 1.82.0
Version 1.100.0-nightly
wapl.es
...This needs to
be wrapped in a match to be usable by sort_unstable_by in Triangle::sorted_clockwise:
points.sort_unstable_by(|a, b| {
let order = sort_clockwise(*a, *b, center);
match order {
true => Ordering::Greater,
false => Ordering::Less
}
});
Changing to use Ordering
The above code doesn't feel...
Miscellaneous
2020-07-28
~11 min read
docs.rs
...This is because reverse associations control the left side of a match arm rather than the right side. The function generated will match on a tuple containing all of the function arguments. Match arms will be ordered exactly as written from top to bottom with one exception: any wildcard pattern...
Crate
v1.4.2
2026-11-05
immunant.com
...We added some extra sanity checking for global arrays and found real-world examples where the size of an array declaration didn’t match its definition. Aside from that case, it seems that in practice most global declaration types match their definitions. Functions are another matter entirely. We match extern...
News & Blog Posts
2019-12-24
~15 min read
docs.rs
...If the output matches, the test passes, and if the output doesn't match the test fails. Note that it is also considered a failure if a test actually compiles successfully. To add a test: Create ui-tests/my-awesome-test.rs Write an invalid #[wasm_bindgen] invocation, testing the...
Crate
v0.2.130
2026-10-30
doc.rust-lang.org
primitive bool
...or, a match pattern
match praise_the_borrow_checker {
true => println!("keep praising!"),
false => println!("you should praise!"),
}
Also, since bool implements the Copy trait, we don't have to worry about the move semantics (just like the integer and float primitives).
Now an example of bool cast to integer...
primitive
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
primitive bool
...or, a match pattern
match praise_the_borrow_checker {
true => println!("keep praising!"),
false => println!("you should praise!"),
}
Also, since bool implements the Copy trait, we don't have to worry about the move semantics (just like the integer and float primitives).
Now an example of bool cast to integer...
primitive
std
Stable since 1.0.0
Version 1.100.0-nightly
FOSDEM
video.fosdem.org
...Given its traits, CEL is the perfect match for any Rust project that requires some sort of expression evaluation. We'll cover why that is the case and where these needs emerged from, then dive into the state of the Rust port of the interpreter, covering some of the challenges...
Talk
Alex Snaps
2026-02-01
crates.io
...ExampleError) -> Self { solana_program_error::ProgramError::Custom(e as u32) } } impl solana_program_error::ToStr for ExampleError { fn to_str<E>(&self) -> &'static str { match self { ExampleError::MintHasNoMintAuthority => "Mint has no mint authority", ExampleError::IncorrectMintAuthority => "Incorrect mint authority has signed the instruction", } } }
Crate
v0.8.0
2025-08-11
rust-lang.github.io
...These two variants correspond to concrete types for when the key matched something in the map, and when the key didn't, respectively.
If there isn't a match, the user has exactly one option: insert a value using set, which will also insert the guarantor, and destroy the Entry...
RFC 216
RFC
2014-08-28
~7 min read
dygalo.dev
...Now we can handle the rules and compile CSS selectors for further matching against them:
use kuchiki::Selectors;
fn process_css(document: &NodeRef, css: &str) -> Result<(), InlineError> {
// ...
for rule in rules {
let (selector, block) = rule?;
if let Ok(matching_elements) = document.select(selector) {
for el in matching_elements {
todo!()
}
}
}
Ok...
Learn Standard Rust
2020-08-11
~18 min read
xion.io
...let result = results.into_iter().fold(Ok(vec![]), |mut v, r| match r {
Ok(x) => { v.as_mut().map(|v| v.push(x)); v },
Err(e) => Err(e),
});
and in a loop form:
let mut result = Ok(vec![]);
for r in results {
match r {
Ok(x) => result.as_mut().map...
News & Blog Posts
2017-04-11
~5 min read
doc.rust-lang.org
pub fn chars(&self) -> Chars<'_>
...It's important to remember that char represents a Unicode Scalar Value, and might not match your idea of what a 'character' is. Iteration over grapheme clusters may be what you actually want. This functionality is not provided by Rust's standard library, check crates.io instead.
Examples
Basic usage...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
blog.logrocket.com
...However, a matches the word, which matches words (“at least one word“). So, our string that contains invalid word separators still successfully matches the words rule because words is only matching part of the input.
We can rectify this by changing our rule to parse until the end of the...
News & Blog Posts
2020-06-23
~20 min read