bluejekyll.github.io
...for (l, r) in l.chars().zip(r.chars()) {
match l.to_lowercase().cmp(r.to_lowercase()) {
o @ Ordering::Less | o @ Ordering::Greater => return o,
Ordering::Equal => continue,
}
}
} else {
match l.cmp(r) {
o @ Ordering::Less | o @ Ordering::Greater => return o,
Ordering::Equal => continue,
}
}
}
And the new timings:
running 9...
News & Blog Posts
2018-01-02
~26 min read
ferrous-systems.com
...The process was challenging but matched
what we’ve come to expect from Rust: It enables building correct software at a
much lower cost.”
With this step, we can start rolling out the sales process on Ferrocene. Our
initial availability is limited to a minimum order of 10 license seats...
Project/Tooling Updates
2023-11-08
~1 min read
doc.rust-lang.org
...use std::num::ParseIntError;
fn main() -> Result<(), ParseIntError> {
let number_str = "10";
let number = match number_str.parse::<i32>() {
Ok(number) => number,
Err(e) => return Err(e),
};
println!("{}", number);
Ok(())
}
Rust by Example
Book
2024-01-01
~1 min read
rust-lang.github.io
...The crate file I downloaded matches the cksum in the index; the index matches the cksum in the audit log; the public key used in the audit log is the one I expected.
This scheme could be augmented to allow the use of several signing technologies. We would need to...
RFC 3231
RFC
2022-02-02
~24 min read
kitsu.me
...Write>(&self, out: &mut Output<W, Db>) -> serialize::Result {
match *self {
Language::En => out.write_all(b"en")?,
Language::Ru => out.write_all(b"ru")?,
Language::De => out.write_all(b"de")?,
}
Ok(IsNull::No)
}
}
That's a little bit verbose, though pretty straightforward. We just write down bytes to...
News & Blog Posts
2020-06-02
~4 min read
lukesteensen.com
...I've
update the code here to match the released APIs and added a section on the new
tokio-io crate.
Introduction
With that out of the way, what is Tokio? The project's most direct inspiration
was Scala's Finagle. Unlike the Scala and the JVM, however, Rust didn...
News & Blog Posts
2016-12-27
~8 min read
tonyarcieri.com
...Path, buffer : &mut[u8]) {
let mut fd = File::open(&path);
match fd.read(buffer) {
Err(what) => panic!("say {}", what),
Ok(x) => if x < 1 { return; }
}
let len = buffer[0] as usize;
let mut outfd = File::create(&outpath);
match outfd.write_all(&buffer[0 .. len]) {
Err(what) => panic!("say {}", what),
Ok...
Notable Links
2015-03-23
~5 min read
rust-trends.com
...Enums where one variant is substantially larger than the others no longer force every match arm to allocate space for the largest case.The post at dystroy.org includes concrete before-and-after examples from real code, showing both the struct layout change and the corresponding reduction in stack frame...
Newsletters
2026-05-06
~4 min read
siciarz.net
...let docopt = match Docopt::new(USAGE) {
Ok(d) => d,
Err(e) => e.exit(),
};
println!("{}", docopt);
let args: Args = match docopt.decode() {
Ok(args) => args,
Err(e) => e.exit(),
};
Docopt::new() returns a Result<Docopt, Error> value. The errors from docopt have a handy exit() method that prints the error message...
Blog Posts
2014-12-08
~4 min read
steveklabnik.com
...pub fn append(&mut self, other: &mut Self) {
match self.tail {
None => mem::swap(self, other),
Some(mut tail) => {
if let Some(mut other_head) = other.head.take() {
unsafe {
tail.as_mut().next = Some(other_head);
other_head.as_mut().prev = Some(tail);
}
self.tail = other.tail.take();
self.len...
News & Blog Posts
2018-09-18
~5 min read
sindrejohansen.no
...They have similar support for tagged unions and pattern matching. They both
handle errors using the sum-type Result. It’s easy to see how they are
inspired by a similar set of languages.
The big difference is that Elm compiles to JS and Rust compiles to machine code.
The...
News & Blog Posts
2018-11-20
~5 min read
bluss.github.io
...macro_rules! try_control {
($e:expr) => {
match $e {
x => if x.should_break() {
return x;
}
}
}
}
Blog Posts
2016-10-18
~2 min read
hermitcore.org
...Rust features like iterators, closures, pattern matching, option and result, string formatting, and the ownership system are still usable for a kernel developers.
This was the motivation to evaluate Rust for HermitCore and to develop an experimental version of our libOS in Rust.
Components like the IP stack and uhyve...
News & Blog Posts
2018-06-12
~1 min read
implfuture.dev
...Request<Body>) -> Self::Future {
match <R as Routable>::recognize(req.uri().path()).is_some() {
// if request path matches Yew route, serve S
true => self.yew_service.call(req),
// else serve F
false => self.fallback_service.call(req),
}
}
}
For the full version, check it out on GitHub.With a Yew-route...
Rust Walkthroughs
2022-10-05
~20 min read
jabberwocky.ca
...Address, data: &mut [u8]) -> Result<(), Error> {
match addr {
// Read from Data Port
0x00 | 0x02 => {
},
// Read from Control Port
0x04 | 0x06 => {
},
_ => { println!("{}: !!! unhandled read from {:x}", DEV_NAME, addr); },
}
Ok(())
}
fn write(&mut self, addr: Address, data: &[u8]) -> Result<(), Error> {
match addr {
// Write to Data Port
0x00 | 0x02 => {
},
// Write to Control...
Rust Walkthroughs
2022-01-12
~31 min read
asyncmove.com
Archived: primary link replaced with an archive on 2026-09-12T11:26:49.391Z (UTC; replacement date, not snapshot date)
...usize) -> Result<[u8; 32], &'static str> {
let mut trimmed_address = [0u8; 64];
let mut i = 0;
while i < 64 && start + i < address.len() {
trimmed_address[i] = address.as_bytes()[start + i];
i += 1;
}
let mut bytes = [0u8; 32];
let mut j = 0;
while j < 32 {
let byte = match (
hex_char...
Rust Walkthroughs
2025-01-15
~7 min read
thunderseethe.dev
...Because Identifier will match let_keyword it’s longer match will win out over LetKw’s let match.We use regex to recognize our integers and whitespace as well.
An integer is one or more digits, recognized by \d+.
Whitespace is one or more spaces, recognized by \s+.Our last...
Rust Walkthroughs
2025-11-12
~34 min read
rust-lang.github.io
...Commands such as cargo check --workspace skip workspace members whose requirements do not match the selected target, much like required-features skips cargo-targets when their required features are not enabled.
[package]
name = "hello_cargo"
required-targets = 'cfg(any(target_os = "linux", target_os = "macos"))'
Motivation
For more background, see...
RFC 4013
RFC
2026-10-02
~28 min read
blog.nindalf.com
...no_mangle with extern "C" matches 35.8k files.
no_mangle without extern "C" matches 14.8k files.
About a third of functions with this attribute use the Rust ABI. They could be making a conscious choice here, we don’t know. For example, someone on internals.rust-lang.org...
Observations/Thoughts
2023-03-01
~5 min read
ruudvanasseldonk.com
...Let’s try again:pub enum KelvinError {
ParseFailed,
InvalidVersion
}
pub fn check_next_version(previous_versions: &[u32],
version_string: &str)
-> Result<u32, KelvinError> {
let version = match version_string.parse::<u32>() {
Ok(n) => n,
Err(_) => return Err(KelvinError::ParseFailed)
};
if version < previous_versions.iter().cloned().min() {
Ok(version)
} else {
Err(KelvinError...
From the Blogosphere
2015-06-22
~11 min read