github.com
...Attribute
invocations can only match the `attr` rules, and non-attribute invocations can
only match the non-`attr` rules. This allows adding `attr` rules to an existing
macro without breaking backwards compatibility.
An attribute macro may emit code containing another attribute, including one
provided by an attribute macro. An attribute...
RFC 3697
RFC
2024-09-20
~8 min read
blog.none.at
...If the target returns both the HTML element and the cookie on every single response, the iteration count, HTML match count, and header match count should be identical — any mismatch indicates a parsing or check evaluation bug:=== per-worker results ===
worker iterations html_match header_match ok?
-------------------------------------------------------------------------------------
http://worker1:9091...
Project/Tooling Updates
2026-03-18
~25 min read
matklad.github.io
...Repr::Custom(Box::new(Custom { kind, error })),
}
}
pub fn get_ref(
&self,
) -> Option<&(dyn error::Error + Send + Sync + 'static)> {
match &self.repr {
Repr::Os(..) => None,
Repr::Simple(..) => None,
Repr::Custom(c) => Some(&*c.error),
}
}
pub fn into_inner(
self,
) -> Option<Box<dyn error::Error + Send + Sync>> {
match self.repr {
Repr...
Observations/Thoughts
2020-10-21
~8 min read
github.com
...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
~4 min read
github.com
...eprintln!("[{}:{}] {} = {:#?}", file!(), line!(), stringify!($expr), &expr);
expr
}
}
}
}
```
The use of `match` over `let` is similar to the implementation of `assert_eq!`.
It [affects the lifetimes of temporaries](
https://stackoverflow.com/questions/48732263/why-is-rusts-assert-eq-implemented-using-a-match#comment84465322_48732525).
## Drawbacks
[drawbacks]: #drawbacks
Adding to the prelude...
RFC 2361
RFC
2018-03-13
~8 min read
fredrik.anderzon.se
...Knock, knock", fruits[i]);
println!("WHO'S THERE???");
},
3 => {
println!("{}", fruits[i]);
println!("{}, who?", fruits[i]); },
4 => {
println!("{} you glad I didn't say {}?", fruits[i], fruits[0]);
println!("facepalm");
},
// Rust wants to make sure your match statements always get a match to avoid
// unexpected behaviors, `_` is the "default" or...
News & Blog Posts
2016-05-16
~19 min read
upsuper.github.io
...matches (Pattern) -> &strfn trim_start_matches (Pattern) -> &strfn trim_end_matches (Pattern) -> &strMatching and findingfn contains (Pattern) -> boolfn starts_with (Pattern) -> boolfn ends_with (Pattern) -> boolfn find (Pattern) -> Option<usize>fn rfind (Pattern) -> Option<usize>fn matches (Pattern) -> Iterator<Item = &str>fn rmatches (Pattern) -> Iterator<Item = &str>fn match_indices...
News & Blog Posts
2019-04-30
~8 min read
home.expurple.me
Table of Contents“Using thiserror for libraries and anyhow for applications”Pattern matching isn’t the only reason to use structured errorsThe tradeoffsTo be continuedRelated readingDiscussTL;DR I prefer thiserror enums over anyhow, even for application code that
simply propagates errors. Custom error types require additional effort, but make
the...
Observations/Thoughts
2025-06-04
~8 min read
www.freecodecamp.org
...In main let's check that the action passed as an argument is "complete" by using an else if statement:
// in the main function
if action == "add" {
// add action snippet
} else if action == "complete" {
match todo.complete(&item) {
None => println!("'{}' is not present in the list", item),
Some(_) => match todo...
Rust Walkthroughs
2021-01-06
~22 min read
blog.veeso.dev
...Option<Vec<(ColumnDef, Value)>>, op: &Operation,) -> Option<Vec<(ColumnDef, Value)>> { match (row, op) { (_, Operation::Insert(_, record)) => Some(record.clone()), (_, Operation::Delete(_)) => None, (None, Operation::Update(_, _)) => None, (Some(mut existing_row), Operation::Update(_, updates)) => { for (col_name, new_value) in updates { if let Some((_, value)) = existing_row .iter_mut() .find(|(col...
Observations/Thoughts
2025-12-10
~6 min read
swatinem.de
...for item in iter {
let item = match item {
Ok(item) => item,
Err(_) => break,
};
// ...
}
// or we can skip over errors:
for item in iter {
let item = match item {
Ok(item) => item,
Err(_) => continue,
};
// ...
}
// or even simpler, since `Result` implements `IntoIterator`:
for item in iter.flatten() {
// ...
}
We can also directly collect this...
Observations/Thoughts
2022-07-13
~4 min read
rust-analyzer.github.io
#11869 (first contribution) allow tildes as code block fences:
#11866 (first contribution) avoid underflows in range conversion.
#11857, #11886 decrease relevance of postfix completions.
#11840 fix another const generic panic.
#11842 fix duplicate type mismatches with blocks.
#11844 fix divergence detection for bare match arms.
#11852 expand asm! to infinite...
Project/Tooling Updates
2022-04-06
~1 min read
rust-analyzer.github.io
...the augmentsSyntaxTokens capability on VS Code.
#14802 fix layout for hir_ty::Ty and friends.
#14820 expand format_args! with more details.
#14851 handle match scrutinee in closure captures.
#14855 consider block impls in lookup_impl_assoc_item_for_trait_ref.
#14863 consider all tokens in macro calls when analyzing...
Project/Tooling Updates
2023-05-24
~1 min read
github.com
...If code only cares about the `values` and `formats` fields, working
with a struct variant is nicer:
```rust
match msg {
// you can reorder too!
Bind { values, formats, .. } => ...
// ...
}
```
versus
```rust
match msg {
Bind(_, _, formats, values, _) => ...
// ...
}
```
This feature gate was originally put in place because there were many serious
bugs in the...
RFC 418
RFC
2014-10-25
~2 min read
notes.eatonphil.com
...Vec<char> = contents.chars().collect();
let tokens = match lex::lex(&raw) {
Ok(tokens) => tokens,
Err(msg) => panic!("{}", msg),
};
let ast = match parse::parse(&raw, tokens) {
Ok(ast) => ast,
Err(msg) => panic!("{}", msg),
};
let pgrm = eval::compile(&raw, ast);
eval::eval(pgrm);
}
Easy peasy. Now let's implement lex.
Lexical analysisLexical...
Rust Walkthroughs
2021-12-29
~25 min read
quickwit.io
...The query parser already supports this feature, for instance "quickwit tan"* will match documents containing "quickwit tantivy" and "quickwit tango".Regex tokenizer: Tokenization based on regex patterns.Coerce option: Convert values instead of returning an error during indexing.Slop in phrase queries supports now transpositions. "quickwit tantivy"~2 will match...
Project/Tooling Updates
2023-06-21
~2 min read
git-cliff.org
...Thanks to @Kriskras99 for implementing this in #1173!
🧮 Support matching arrays via parsers
The commit parser has been extended to support regex matching on array values, such as remote.pr_labels.
For example, this makes it possible to group commits based on their GitHub labels as follows:
[git]commit...
Project/Tooling Updates
2025-07-30
~4 min read
poor.dev
...To make this work, we intercept this instruction in the rendered bytes with a regex, changing the document.title to match:
wsTerminal.onmessage = function (event) {
// ...
let data = event.data;
const titleRegex = /\x1b\]0;([^\x07\x1b]*?)(?:\x07|\x1b\\)/g;
let match;
while ((match = titleRegex.exec(data)) !== null) {
document.title = match[1...
Observations/Thoughts
2025-08-20
~12 min read
www.ncameron.org
...Pattern matching
The goal with the pattern matching API is to allow procedural macros to operate on tokens in the same way as macros-by-example. The pattern language is thus the same as that for macros-by-example.
There is a single macro, which I propose calling matches. Its...
News & Blog Posts
2016-01-25
~16 min read
llogiq.github.io
...Call into the element
chain recursively to remove it if found
Simply removing the existing code and coding up a match block with the three
cases led to much easier code and a performance win. Apparently this time the
compiler didn’t see through the second match and the extra...
News & Blog Posts
2018-08-07
~4 min read