matklad.github.io
...Option<Walrus>) {
let walrus = match walrus {
Some(it) => it,
None => return,
};
...
}
As in the example above, this often comes up with preconditions: a
function might check precondition inside and “do nothing” if it
doesn’t hold, or it could push the task of precondition checking to
its caller, and enforce...
Observations/Thoughts
2023-11-22
~3 min read
qouteall.fun
...In that case the match expression outputs a value. That match has two branches. Each branch also output a value.
Because the match target cache.get(&key) indirectly borrows cache mutably. And the second branch Some(v) => {v}'s output indirectly borrow match target. This indirect borrow of cache is...
Rust Walkthroughs
2025-10-29
~64 min read
docs.rs
...Features Generates efficient data parsers and serialisers for structs and enums using #[derive] Reads and writes data from any source using standard io::Read and io::Write streams Directives in attributes handle common binary parsing tasks like matching magic numbers, byte ordering, padding & alignment, data validation, and more Includes reusable...
Crate
v0.15.2
2026-07-23
www.fluvio.io
...This meant that we needed a separate filter per pattern we wanted to match on.
However we've added the capability to pass in user inputs at the time of execution. So we can have a single filter covering multiple patterns based on how we use it.
This is an...
Project/Tooling Updates
2021-11-03
~3 min read
rustc-dev-guide.rust-lang.org
...A node is considered to match a filter if all of those strings appear in its label. So, for example:
RUST_DEP_GRAPH_FILTER='-> TypeckTables'
would select the predecessors of all TypeckTables nodes. Usually though you want the TypeckTables node for some particular fn, so you might write:
RUST_DEP...
Guide to Rustc Development
Book
2024-01-01
~3 min read
steveklabnik.com
...the profit from the book won’t go to me, it will go to OpenHatch, “a non-profit dedicated to matching prospective free software contributors with communities, tools, and education,” to use their words about it.
I’ll let you know when we’re closer to actually shipping!
News & Blog Posts
2015-09-14
~1 min read
github.com
...The drawbacks of this idea are covered in the motivation.
### Make `extern crate` match fuzzily
Alternatively, we can have the compiler consider hyphens and underscores as equal while looking up a crate. In other words, the crate `flim-flam` would match both `extern crate flim_flam` and `extern crate "flim...
RFC 940
RFC
2015-03-05
~3 min read
blogs.kde.org
...The mapping of completion match metadata to Kate's format (from fundamentals like the match type, to more complex features like smart grouping) can likely be improved still. Ditto for auto-completion behavior (i.e. defining the circumstances in which the completion popup will kick in automatically, as opposed to...
Project Updates
2015-05-18
~3 min read
blog.aloni.org
...Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
match self.fib.state {
State::Halted => {
self.fib.state = State::Running;
Poll::Ready(())
}
State::Running => {
self.fib.state = State::Halted;
Poll::Pending
}
}
}
}
Executor
Our executor keeps a vector of uncompleted futures, where the state of each
future is located on the...
News & Blog Posts
2020-01-28
~3 min read
aminediro.com
...u8, buf: &mut Vec<u8>) -> Result<usize> {
loop {
let (done, used) = {
let available = match r.fill_buf() {
// ...
};
match memchr::memchr(delim, available) {
Some(i) => {
buf.extend_from_slice(&available[..=i]);
(true, i + 1)
}
None => {
buf.extend_from_slice(available);
(false, available.len())
}
}
};
r.consume(used);
read += used;
if done || used...
Rust Walkthroughs
2024-01-24
~22 min read
docs.rs
...While checks are all tested // and must all succeed, allow/deny policies are tried one by one in order, // and we stop verification on the first that matches // // here we will check that the token has the corresponding right allow if right("/a/file1.txt", "read"); // explicit catch-all deny...
Crate
v6.0.0
2025-07-16
dev.to
...EnumValue<PhoneType>,
// ...
}
// Match directly - the type carries the known/unknown distinction:
match contact.phone_type {
EnumValue::Known(PhoneType::MOBILE) => { /* ... */ }
EnumValue::Known(PhoneType::HOME) => { /* ... */ }
EnumValue::Known(PhoneType::WORK) => { /* ... */ }
EnumValue::Unknown(v) => { /* v is the raw i32 from the wire */ }
}
// Or compare directly (PartialEq<E> is implemented):
if contact.phone_type == PhoneType...
Project/Tooling Updates
2026-03-25
~13 min read
crates.io
...writer.push(i).is_some() { // The ringbuffer is full, yield the thread std::thread::yield_now(); } }); // Loop that pulls elements from the ringbuffer loop { match reader.pull() { // We have got an element, do something Some(t) => std::hint::blackbox(t), // The ringbuffer is empty, yield the thread None => std::thread...
Crate
v0.2.2
2026-01-27
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
...use std::io;
use std::net::TcpListener;
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
listener.set_nonblocking(true).expect("set_nonblocking should succeed");
for stream in listener.incoming() {
match stream {
Ok(s) => {
// do something with the TcpStream
handle_connection(s);
}
Err(ref e) if e.kind() == io...
method
std
Stable since 1.9.0
Version 1.100.0-nightly
github.com
...Py_ssize_t, ) -> *mut PyObject { if nargs != 2 { PyErr_SetString( PyExc_TypeError, c"sum_as_string expected 2 positional arguments".as_ptr(), ); return std::ptr::null_mut(); } let (first, second) = (*args, *args.add(1)); let first = match parse_arg_as_i32(first, 1) { Some(x) => x, None => return std::ptr...
Crate
v0.29.2
2026-08-05
llogiq.github.io
...bad_bit_mask,
cmp_nan,
eq_op,
empty_loop,
match_overlapping_arm,
ineffective_bit_mask,
min_max,
modulo_one,
nonsensical_open_options,
out_of_bounds_indexing,
range_step_by_zero,
unit_cmp and others
Readability – a good many lints suggest readability improvements, such as
approx_constant,
block_in_if_condition...
Notable New Crates & Project Updates
2016-02-01
~3 min read
arxiv.org
...These guarantees come from a strong ownership-based type system, as well as primitive support for features like closures, pattern matching, etc., that make the code more concise and amenable to reasoning. These unique Rust features also pose a steep learning curve for programmers.
This paper presents a tool called...
Research
2023-08-23
~1 min read
docs.rs
...Therefore, all events can be handled in a single match expression. Many functions (such as wait_for_event ) return a xcb::Result which allows idiomatic error handling. fn main() -> xcb::Result<()> { // ... loop { match conn.wait_for_event()? { xcb::Event::X(x::Event::KeyPress(key_press)) => { // do stuff } xcb::Event::Xkb...
Crate
v1.7.1
2026-08-09
fitzgeraldnick.com
...querying each field of a struct, matching on a variant and querying
each of the matched variant’s children. It is also mechanically implemented
inside #[derive(Term)].
The final querying puzzle piece is a combinator putting the one-layer querying
traversal together with generic query functions into recursive querying
traversal...
News & Blog Posts
2017-08-08
~15 min read
www.simonclark.dev
...Vec<u32>,
}
pub fn solve_sudoku(input: &mut Sudoku) -> bool {
match find_first_empty(&input.board) {
None => true,
Some((row, col)) => {
for option in options_for(&input.board, row, col){
let idx = (row * 9 + col) as usize;
input.board[idx] = option;
if solve_sudoku(input) {
return true;
}
input.board[idx...
Observations/Thoughts
2021-04-21
~5 min read