esimmler.com
...DomainType<T>,
{
match val {
Val::Var(var) => {
let resolved = self.domain.values_as_ref().get(var);
match resolved {
// We found another Var, try to resolve deeper
Some(found) => self.resolve_val(found),
// We didn't find a binding, return the Var
None => val,
}
}
// This isn't a Var, just return...
News & Blog Posts
2020-07-14
~6 min read
system76.com
...System76 offers health benefits, paid vacation, matching 401k, sabbatical, and an awesome dog-friendly work environment where smart people are free to create.
We are committed to providing equal employment opportunities to all employees and applicants, regardless of race, color, creed, religion, sex, gender identity/expression, age, national origin, disabilities...
Rust Jobs
2020-06-10
~1 min read
doc.rust-lang.org
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
...The key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type.
Examples
use std::collections::BTreeMap;
let mut map = BTreeMap::new();
map.insert(1, "a");
assert_eq!(map.remove_entry(&1), Some((1...
method
alloc
Stable since 1.45.0
Version 1.100.0-nightly
blog.urth.org
...Then it generates a CSS file containing just those strings
which match actual Tailwind names.But this scanning process, because it matches so broadly, errs on the side of false positives, and
the tailwindcss program will not emit any warnings when it finds a string that could be a match...
Rust Walkthroughs
2022-02-23
~16 min read
rust-analyzer.github.io
...true
#3580 macro expander is now more tolerant for syntax errors, which makes code completion inside macros more robust.
#3623 Fill Match Arms assist now works even if some arms are already present.
#3607 and instructions for installing rust-analyzer from AUR.
#3640, #3651 assist to merge imports with a...
News & Blog Posts
2020-03-24
~1 min read
dev.to
...This method makes sure that the mock server received exactly one HTTP request that matched all the mock requirements. If not, it will fail the test with a detailed problem description (see next section).
Verification
Mock objects provide an assert method which ensures our app did actually send a request...
Rust Walkthroughs
2020-11-04
~6 min read
www.justanotherdot.com
...macro_rules! time {
($val:expr) => {
{
let beg = std::time::Instant::now();
match $val {
tmp => {
let end = std::time::Instant::now();
let time = (end - beg);
println!("[{}:{}] `{}' took {:?}", std::file!(), std::line!(), std::stringify!($val), time);
tmp
}
}
}
};
($($val:expr),+ $(,)?) => {
($(time!($val)),+,)
};
}
This change uses the repeat pattern matches of macros to consistently...
Observations/Thoughts
2020-08-26
~4 min read
rust-analyzer.github.io
#9936 (first contribution) make compiler commit and date optional in proc macros.
#9962 (first contribution) improve "Replace match with if let" code generation.
#9963 resolve core::arch module.
#9973, #9988 refactor and improve handling of overloaded binary operators.
#9943 don’t strip items with built-in attributes.
#9976 hide functional...
Project/Tooling Updates
2021-08-25
~1 min read
arXiv
arxiv.org
...We present GRAFT, which extracts structured API information from Rust documentation, builds an API dependency graph via recursive generics-aware type matching, and uses topology-guided traversal plus LLM synthesis with compiler-error feedback to produce compilable fuzz targets. On 13 crates from crates.io, GRAFT achieves 80.75% macro...
Software Engineering
Yiming Chen, Kaiwen Zhang, Guanjun Liu et al.
2026-08-09
arXiv:2608.08637
docs.rs
...use std::io::Read; use wl_clipboard_rs::{paste::{get_contents, ClipboardType, Error, MimeType, Seat}}; let result = get_contents(ClipboardType::Regular, Seat::Unspecified, MimeType::Text); match result { Ok((mut pipe, _)) => { let mut contents = vec![]; pipe.read_to_end(&mut contents)?; println!("Pasted: {}", String::from_utf8_lossy(&contents)); } Err(Error::NoSeats...
Crate
v0.8.2
2026-05-07
rust-lang-nursery.github.io
...use std::time::Duration;
use tokio::time::timeout;
async fn fetch_network_request() -> u32 {
89
}
#[tokio::main]
async fn main() {
match timeout(Duration::from_millis(5), fetch_network_request()).await {
Ok(x) => println!("Received {x}"),
Err(_) => eprintln!("Timed Out!"),
}
}
Add tokio to Cargo.toml with the macros and time features...
The Rust Cookbook
Book
2024-01-01
~1 min read
github.com
...The bindings are checked in CI to ensure that what exists in git matches the output of the script. License This project is licensed under either of Apache License, Version 2.0, ( LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 ) MIT license ( LICENSE-MIT or http://opensource...
Crate
v0.1.13+1.68.1
2026-03-31
matklad.github.io
...u32,
) -> io::Result<Option<Widget>> {
let key = id.to_be_bytes();
let value = match self.db.load(&key)? {
None => return Ok(None),
Some(it) => it,
};
let widget: Widget =
bincode::deserialize(&value).map_err(|it| {
io::Error::new(io::ErrorKind::InvalidData, it)
})?;
Ok(Some(widget))
}
}
Now, for the sake of argument...
Rust Walkthroughs
2022-06-15
~6 min read
rauljordan.com
...Match statements are very flexible and structural in nature
Instead of nesting match statements, for example, one could bring values together as tuples and do
the following:
fn player_outcome(player: &Move, opp: &Move) -> Outcome {
use Move::*;
use Outcome::*;
match (player, opp) {
// Rock moves.
(Rock, Rock) => Draw,
(Rock, Paper) => Lose...
Rust Walkthroughs
2023-01-25
~26 min read
56:25
Rustacean Station
rustacean-station.org
Episode: Idiomatic Rust with Brenden Matthews
...And then you always have like a else match case, like what to do when none of the other matches match.
I assume you would use it with enums a lot, right?
Where you have like multiple.
Options within your enum and you essentially just want to like go through...
Podcast
2025-01-04
56:25
doc.rust-lang.org
pub fn unwrap(self) -> T
...Instead, prefer to use the ? (try) operator, or pattern matching to handle the Err case explicitly, or call unwrap_or, unwrap_or_else, or unwrap_or_default.
Panics
Panics if the value is an Err, with a panic message provided by the Err's value.
Examples
Basic usage:
let x...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
rust-analyzer.github.io
...type mismatch with associated types.
#12427 fix VSCode config patching incorrectly patching some configs.
#12444 implement parsing of ? opt-out trait bounds.
#12467 fix Match to if-let assist for wildcard patterns.
#12470, #12472 avoid duplicating output channels when restarting the server.
#12471 restart the server instead of reloading the...
Project/Tooling Updates
2022-06-08
~1 min read
doc.rust-lang.org
pub fn split_paths<T>(unparsed: &T) -> SplitPaths<'_>
...Examples
use std::env;
let key = "PATH";
match env::var_os(key) {
Some(paths) => {
for path in env::split_paths(&paths) {
println!("'{}'", path.display());
}
}
None => println!("{key} is not defined in the environment.")
}
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn incoming(&self) -> Incoming<'_>
...TcpStream) {
//...
}
fn main() -> std::io::Result<()> {
let listener = TcpListener::bind("127.0.0.1:80")?;
for stream in listener.incoming() {
match stream {
Ok(stream) => {
handle_connection(stream);
}
Err(e) => { /* connection failed */ }
}
}
Ok(())
}
method
std
Stable since 1.0.0
Version 1.100.0-nightly