rust-lang.github.io
...Features:
+ perf Enables all performance related features
+ perf-dfa Enables the use of a lazy DFA for matching
+ perf-inline Enables the use of aggressive inlining inside
match routines
+ perf-literal Enables the use of literal optimizations for
speeding up matches
+ std When enabled, this will cause regex to use...
RFC 3416
RFC
2023-04-14
~3 min read
blog.burntsushi.net
...Vec<StateID>,
// Whether a particular state ID corresponds to a match state.
// Guaranteed to have length equal to the number of states.
is_match_id: Vec<bool>,
}
impl DFA {
// Returns true if the DFA matches the entire 'haystack'.
// This routine always returns either true or false for all inputs.
// It...
Observations/Thoughts
2022-08-10
~33 min read
rust-lang.github.io
...And requiring matching on every use of the type is less ergonomic. For example, the clamp RFC would naturally use a RangeInclusive parameter, but because it still needs to assert!(start <= end) in the NonEmpty arm, the noise of the Empty vs NonEmpty match provides it no value.
• a...b...
RFC 1192
RFC
2015-07-07
~5 min read
FOSDEM
video.fosdem.org
...minimal unsafe at the syscall edge; per-thread isolation with unshare(CLONE_FS|CLONE_FILES) and per-thread seccomp(2); syscall-argument cookies; forced O_CLOEXEC and randomized FDs; deterministic "last-match-wins" policy; and mseal(2) sealing on lock:on. Portability is first-class: one codebase for Linux ≥ 5...
Talk
Ali Polatel
2026-02-01
rustc-dev-guide.rust-lang.org
...In the names->numbers phase, if the query has only one name in it, the editDistance function is used to find a near match if the exact match fails, but if there's multiple items in the query, non-matching items are treated as generics instead. This means hahsmap will...
Guide to Rustc Development
Book
2024-01-01
~16 min read
matthewkmayer.github.io
...pub fn is_commit_event(&self) -> bool {
self.is_accepted_pr() || self.is_direct_push_event()
}
pub fn is_accepted_pr(&self) -> bool {
if self.event_type != "PullRequestEvent" {
return false;
}
match self.payload {
Some(ref payload) => match payload.pull_request {
Some(ref pr) => match pr.merged {
Some(merged) => merged,
None...
Learn
2020-07-28
~11 min read
steveklabnik.com
...u32 = match guess.trim().parse() {
Ok(num) => num,
Err(_) => continue,
};
println!("You guessed: {}", guess);
match guess.cmp(&secret_number) {
Ordering::Less => println!("Too small!"),
Ordering::Greater => println!("Too big!"),
Ordering::Equal => {
println!("You win!");
break;
}
}
}
}
We aren’t quite properly re-using the buffer here, but we could modify this...
Learn Simple Rust
2020-10-21
~4 min read
siciarz.net
...u8) -> OpCode {
match opcode {
0 => OpCode::Continue,
1 => OpCode::Text,
2 => OpCode::Binary,
8 => OpCode::Close,
9 => OpCode::Ping,
10 => OpCode::Pong,
_ => OpCode::Reserved,
}
}
}
#[derive(Debug)]
struct WebSocketFrame {
fin: bool,
opcode: OpCode,
mask: bool,
length: u64,
masking_key: u16,
payload: Vec<u8>,
}
We're using a custom enum to make...
24 Days of Rust
2016-12-13
~5 min read
lazy.codes
...match x { 1 + 3 => {} } results in a syntax error while match x { const { 1 + 3 } => {} }does not.
if_let_guard
Extends the if guards that you can use with match statements to be able to use if let.
let_chains
Currently, if let and while let expressions can not be...
Rust Walkthroughs
2021-07-28
~18 min read
dev.to
...if let Some(e) = err.find::<Error>()
Enter fullscreen mode
Exit fullscreen mode
In such case, we'll match each and every Error branch and return an appropriate response. Matching against ValidationError will extract validation errors and serialize them as part of request. In a real world scenario, you'd...
Rust Walkthroughs
2021-01-27
~4 min read
developer.ibm.com
...In this context, I match _f against the possible error values (Ok and Err). For Ok, I return the file for assignment; for Err, I use panic!.
use std::fs::File;
fn main() {
let _f = File::open("file.txt");
let _f = match _f {
Ok(file) => file,
Err(why) => panic!("Error...
Observations/Thoughts
2021-01-06
~11 min read
github.com
...And requiring matching on every
use of the type is less ergonomic. For example, the clamp RFC would
naturally use a `RangeInclusive` parameter, but because it still needs
to `assert!(start <= end)` in the `NonEmpty` arm, the noise of the `Empty`
vs `NonEmpty` match provides it no value.
- `a...b...
RFC 1192
RFC
2015-07-07
~5 min read
doc.rust-lang.org
...invalid lifetime parameter name: `'static`
fn invalid_lifetime_parameter<'static>(s: &'static str) -> &'static str { s }
•
safe is used for functions and statics, which has meaning in external blocks.
•
raw is used for raw borrow operators, and is only a keyword when matching a raw borrow operator form (such as...
The Rust Reference
Book
2024-01-01
~2 min read
crates.io
...shortcuts(["ctrl+d", "alt+space"])? .with_handler(|app, shortcut, event| { if event.state == ShortcutState::Pressed { if shortcut.matches(Modifiers::CONTROL, Code::KeyD) { let _ = app.emit("shortcut-event", "Ctrl+D triggered"); } if shortcut.matches(Modifiers::ALT, Code::Space) { let _ = app.emit("shortcut-event", "Alt+Space triggered"); } } }) .build(), )?; } Ok(()) }) .run(tauri::generate...
Crate
v3.0.0-alpha.3
2026-10-14
docs.rs
The tree-sitter Language type, used by the library and by language implementations Tree-sitter Language This crate provides a LanguageFn type for grammars to create Language instances from a parser, without having to worry about the tree-sitter crate version not matching.
Crate
v0.1.9
2026-10-08
smallcultfollowing.com
...It’s at least kind of scary.On a related note, right now, because match code is built into the
compiler, we allow it to inspect freely without worrying about
whether data is mutably borrowed or not. We know, after all, that
during a match the only possibility for side...
Announcements etc
2013-11-19
~13 min read
rust-lang.github.io
...As such, the lang team will need to approve the high-level answer.
•
Do match guards have semantic meaning?
Match guards are inserted by the compiler around match statements to ensure that if guards cannot change the value being matched on. Whether match guards should exist at all primarily affects...
RFC 3346
RFC
2022-11-07
~8 min read
thunderseethe.dev
...comb.goal.clone(),
})
} else {
None
}
});
match poss_uni {
// Unify if we have a match
Some(match_comb) => {
self.unify_row_row(new_comb.left, match_comb.left)?;
self.unify_row_row(new_comb.right, match_comb.right)?;
self.unify_row_row(new_comb.goal, match_comb.goal)?;
}
// Otherwise add our...
Observations/Thoughts
2023-10-25
~29 min read
rust-analyzer.github.io
Fixes
#13749 don’t show duplicated adjustment hints for blocks, ifs and matches.
#13742 only shift BoundVars that come from outside lowering context (fixes a crash with GATs).
#13750 normalize projection after discarding free BoundVars in RPIT (fixes a crash during normalization).
Project/Tooling Updates
2022-12-14
~1 min read