owengage.com
...let mut start = self.index;
loop {
while self.index < self.slice.len()
&& !ESCAPE[self.slice[self.index] as usize] {
self.index += 1;
}
if self.index == self.slice.len() {
return error(self, ErrorCode::EofWhileParsingString);
}
match self.slice[self.index] {
b'"' => {
if scratch.is_empty() {
// Fast path: return a slice of the...
Observations/Thoughts
2022-07-27
~10 min read
nicolodavis.com
...You get this for
free in Rust, which will throw an error if you parse data
that doesn’t line up with the struct that is to hold it in
memory.Error HandlingRust’s pattern matching and error handling make it easy to
handle every code path that could result...
News & Blog Posts
2020-07-14
~2 min read
chrismorgan.info
...match instead of if
People often suggest replacing the chained conditionals with a match block, which incidentally lets you skip the “superfluous” i % 15:
for i in 1..101 {
match (i % 3, i % 5) {
(0, 0) => println!("FizzBuzz"),
(_, 0) => println!("Buzz"),
(0, _) => println!("Fizz"),
(_, _) => println!("{}", i),
}
}
Figure 13: Figure 1...
Rust Walkthroughs
2022-03-23
~23 min read
github.com
...STRICT_KEYWORD | RESERVED_KEYWORD ;
fragment STRICT_KEYWORD
: 'as'
| 'box'
| 'break'
| 'continue'
| 'crate'
| 'else'
| 'enum'
| 'extern'
| 'fn'
| 'for'
| 'if'
| 'impl'
| 'in'
| 'let'
| 'loop'
| 'match'
| 'mod'
| 'mut'
| 'once'
| 'proc'
| 'pub'
| 'ref'
| 'return'
| 'self'
| 'static'
| 'struct'
| 'super'
| 'trait'
| 'true'
| 'type'
| 'unsafe'
| 'use'
| 'virtual'
| 'while'
;
fragment RESERVED_KEYWORD
: 'alignof'
| 'be'
| 'const'
| 'do'
| 'offsetof'
| 'priv...
RFC 90
RFC
2014-05-23
~3 min read
blog.codeship.com
...i32 = match start_s.parse() {
Ok(n) => {
n
},
Err(_) => {
println!("error: first argument not an integer");
return;
},
};
let stop_s = args().nth(2).expect("Please provide a max id");
let stop : i32 = match stop_s.parse() {
Ok(n) => {
n
},
Err(_) => {
println!("error: second argument not an integer");
return;
},
};
for x...
News & Blog Posts
2016-12-20
~13 min read
tokio.rs
...Escaping is done with double
braces, so if you want to match a literal { or } character, you can do so
by writing {{ or }}.
We understand that this is a breaking change for basically all axum users, but
we believe that it's better to make this change now than to...
Project/Tooling Updates
2025-01-01
~2 min read
rustinblockchain.org
...Re-design the matching_transaction logic for Ethereum
PR: Unroll some implementations generic over ledger::Bitcoin
PR: Bitcoin matching transactions refactor
Issue: Minimal viable ledger configuration strategy
Grin
28 merged PRs, 12 closed issues.
News: 87: Grin v3.1.0 released
News: 86: New node release in the works
News...
News & Blog Posts
2020-03-03
~6 min read
github.com
...One can expect the ability to match tuple variants like `V(u8, u8, u8)` with patterns like
`V(x, ..)` or `V(.., z)`, but the compiler rejects such patterns currently despite accepting
very similar `V(..)`.
This RFC is intended to "complete" the feature and make it work in all possible list...
RFC 1492
RFC
2016-02-06
~3 min read
www.sea-ql.org
...String,}assert!(matches!(Column::from_str("lAsTnAmE").unwrap(), Column::LastName));
Check if url is well-formed before parsing (avoid panic) #2558
let db = Database::connect("postgre://sea:sea@localhost/bakery").await?;// note the missing `s`; results in `DbErr::Conn`
QuerySelect::column_as method cast ActiveEnum column #2551
#[derive(Debug, FromQueryResult...
Project/Tooling Updates
2025-06-04
~5 min read
blog.orhun.dev
...It is a security policy that prevents the loading of resources that don’t match an expected hash. By doing this, if an attacker were to gain access to a file and modify its contents to contain malicious code, it wouldn’t match the hash we were expecting and not...
Observations/Thoughts
2023-01-04
~10 min read
hashrust.com
...no field `value` on type `Result<f64, u8>`
let value = result.value;
The only safe way to get the value out is to pattern match on atof's return value:
match atof("123.56") {
Ok(val) => { println!("Parsed value is: {}", val)}
Err(e) => { println!("Error is {}", e)}
}
And lastly, there...
Rust Walkthroughs
2022-01-05
~6 min read
rust-embedded.github.io
...This and fixing a bug where searches only return items found until a exact match was found (instead of returning all relevant matches) are in the crates.io team TODO list.
Fix: infinite loops (e.g. loop {}) are lowered to an abort instruction.
Ideally, this should be fixed in LLVM...
News & Blog Posts
2019-02-26
~6 min read
blog.servo.org
...implemented CSS transition DOM events
nox added intemediary, Rust-only WebIDL interfaces that replaced lots of unnecessary code duplication
mathieuh improved web compatibility by matching the new specification changes related to XMLHttpRequest events
emilio improved web compatibility by adding more conformance checks to various WebGL APIs
mortimergoro implemented several missing...
Other Weeklies from Rust Community
2016-10-25
~2 min read
arthurtw.github.io
...Algebraic data type
In addition to the common tuple and struct types, Rust also provides enum types (Rust’s sum types or variant types) and pattern matching. It’s amazing to see such an advanced type system on a systems programming language.
Composition over inheritance
Rust clearly prefers type composition...
Blog Posts
2014-12-29
~10 min read
agourlay.github.io
...pub fn parse_hprof_record(&mut self) -> impl FnMut(&[u8]) -> IResult<&[u8], Record> + '_ {
|i| {
if self.heap_dump_remaining_len == 0 {
- let (r1, tag) = parse_u8(i)?;
- if self.debug_mode {
- println!("Found record tag:{} remaining bytes:{}", tag, i.len());
- }
- match tag {
- TAG_STRING => parse_utf8_string(r1),
- TAG_LOAD...
Observations/Thoughts
2022-08-10
~6 min read
specy.app
...order_simple(4, |c| {
match c {
0 => &[0, 1, 2, 3],
1 => &[2],
2 => &[0, 1],
3 => &[1, 2, 3],
_ => unreachable!(),
}
}); Which… still panics? Ok, ok, ok, let’s recap: The bug happens only in release mode There is no unsafe code anywhere in the library Miri does not report...
Observations/Thoughts
2024-11-20
~6 min read
trifectatech.org
...compare256 tries to find substring matches
crc32 is the checksum that is used for .gz
adler32 is the checksum used in other cases
Often we can clean up the implementation slightly, using slices and iterators. Translating these algorithms to Rust is mostly straightforward.
With the implementation done and validated on...
Rust Walkthroughs
2025-12-10
~6 min read
www.fpcomplete.com
...This allows us to
// test some extra assertions below
std::mem::drop(tx);
let mut i = 0;
loop {
match rx.recv().await {
// All senders are gone, which must mean that
// we're at the end of our loop
None => {
assert_eq!(i, count);
break Ok(());
}
// Something finished successfully, make sure...
Learn More Rust
2020-09-09
~18 min read
github.com
...This is now widely considered to be a mistake, because it makes implementing `Copy` for those types hazardous due to how the two traits interact.
```rust
for x in it.take(3) { // a *copy* of the iterator is used here
// ..
}
match it.next() { // the original iterator (not advanced) is used...
RFC 3550
RFC
2023-12-18
~18 min read
devblog.archlinux.page
...Artifact verifiers can be filtered using OpenPGP fingerprints or domain name matches for OpenPGP User IDs.
simple "trust anchor": Artifacts are verified using artifact verifiers, which in turn must be certified by trust anchors.
Artifact verifiers can be filtered using domain name matches for OpenPGP User IDs and trust anchors...
Project/Tooling Updates
2026-01-14
~22 min read