rust-lang.github.io
...0 };
match t {
Alias::Bar(_i) => {}
Alias::Baz { i: _i } => {}
}
}
Reference-level explanation
If a path refers into an alias, the behavior for enum variants should be as if the alias was substituted with the original type. Here are some examples of the new behavior in edge cases:
type Alias...
RFC 2338
RFC
2018-02-15
~3 min read
jorgeortiz.dev
...The
designers of this functionality of the Rust language decided to separate mechanism and policy, and decided to define the
Future trait in the standard library, while allowing developers to use the runtime that matches their needs for each
project. It is fair to say that tokio is the de...
Rust Walkthroughs
2025-09-17
~6 min read
jack.wrenn.fyi
...In the mean time, use offset_of! and the static_assertions crate to test that your layouts match your expectations.
repr(C) layouts are not always SemVer stable
The limitations of repr(C) are not only technical, but also social. The central social contract of Rust’s crate authors is...
Observations/Thoughts
2024-07-31
~3 min read
rustc-dev-guide.rust-lang.org
...This imposes heavy restrictions on how much we can change when LLDB's output doesn't match what we want. Some workarounds can help, but at the end of the day Rust's needs are secondary compared to making sure C and C++ compilation and debugging work correctly.
LLDB is...
Guide to Rustc Development
Book
2024-01-01
~7 min read
doc.rust-lang.org
...If the pattern does not match (this requires it to be refutable), the else block is executed. The else block must always diverge (evaluate to the never type).
let (mut v, w) = (vec![1, 2, 3], 42); // The bindings may be mut or const
let Some(t) = v.pop() else...
The Rust Reference
Book
2024-01-01
~3 min read
atilanevesoncode.wordpress.com
...Algebraic types and pattern matching. Even though I didn’t use the former.
Slices. Non-allocating views into data? Yes, please. Made the D programmer in me feel right at home.
Immutable by default. Need I say more?
Debugging. rust-gdb makes printing out values easy. I couldn’t figure...
News & Blog Posts
2015-11-16
~7 min read
redox-os.org
...Add JoinHandleExt (matching Unix version)
redox: handle multiple paths in PATH
Remove import
ruuda/thread-id
Redox support
redox-os/orbutils
Remove rustls as direct dependency
libgit2/libgit2
Convert port with htons() in p_getaddrinfo()
redox-os/website
GSoC Status Report 1
GSoC Status Report 2
GSoC Status Report 3...
News & Blog Posts
2017-08-29
~11 min read
stevedonovan.github.io
...These are obviously very different types - what do they have in common?
They both match the trait bound Fn(f64)->f64. Here is a generic function
which simply invokes the closure it has been given:
fn invoke<F>(f: F, x: f64) -> f64
where F: Fn(f64)->f64 {
f(x...
News & Blog Posts
2018-09-04
~12 min read
hoverbear.org
...I love grep and use it with regexs all the time, but in my exploration I actually found some really interesting flags, including one that nulls out newlines for multiline matching. Crazy stuff!
multirust doesn't seem to allow you to configure where it puts the .multirust directory. While I...
Notable New Crates & Project Updates
2016-01-11
~2 min read
www.polymonster.co.uk
...match &info.ds_clear {
None => {
if info.discard {
depth_begin_type = D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD;
stencil_begin_type = D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD;
}
},
Some(ds_clear) => {
match &ds_clear.depth {
Some(depth) => {
depth_begin_type = D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR;
clear_depth = *depth...
Rust Walkthroughs
2022-03-02
~19 min read
dev.to
...Account) -> i32 {
match account.details { //match is like case
AccountDetails::CreditCard(params) => //bind local variable params to the attached data
params.credit_limit, //in Rust, return is implicit
AccountDetails::Savings =>
0
}
}
Since both Elm and Rust don't have null values, you have to specify CreditParams when building an AccountDetails...
News & Blog Posts
2017-02-14
~17 min read
blog.benj.me
...let top11 = match alu_op {
ALUOp::Add32 => 0b00001011_000,
ALUOp::Add64 => 0b10001011_000,
};
Then decide the bits 10 to 15, based on the ALU subopcode as well.
let bit15_10 = match alu_op {
_ => 0b000000,
};
Then use an helper and pass forward the allocated physical registers
values.
sink.put4(enc_arith...
Rust Walkthroughs
2021-02-24
~25 min read
rust-lang.github.io
...Ok(())
}
fn main() -> () {
use std::process::exit;
use libc::{EXIT_SUCCESS, EXIT_FAILURE};
exit(match inner_main() {
Ok(_) => EXIT_SUCCESS,
Err(ref err) => {
let progname = get_program_name();
eprintln!("{}: {}\n", progname, err);
EXIT_FAILURE
}
})
}
These problems can be solved by generalizing the return type of main and test functions.
Detailed...
RFC 1937
RFC
2017-02-22
~21 min read
kerkour.com
...updated_at, name, size, type, explicitly_trashed, trashed_at, namespace_id, parent_id)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)";
match sqlx::query(QUERY)
.bind(file.id)
.bind(file.created_at)
.bind(file.updated_at)
.bind(&file.name)
.bind(file.size)
.bind(&file.r#type)
.bind...
Rust Walkthroughs
2022-01-26
~6 min read
www.ersteiger.com
...RenderJob = match serde_json::from_str(message_body) { Ok(job) => job, Err(e) => { eprintln!("Failed to parse job: {}", e); continue; // Skip this message and move to the next one } }; println!("Processing job {}: template={}", job.job_id, job.template_id); // Get template from S3 let template_result = s3_client .get_object...
Rust Walkthroughs
2025-04-30
~18 min read
nnethercote.github.io
...Replacing them with equivalent match expressions can help compile times.
The effects of these sorts of changes on compile times will usually be small, though occasionally they can be large. Example.
Such changes can also reduce binary size.
The Rust Performance Book
Book
2024-01-01
~2 min read
matklad.github.io
...Option<i32>) {
match value {
None => (),
none => (),
}
}
Syntactically, None and none are
indistinguishable. But they play quite different roles: None refers to the Option::None constant, while
none introduces a fresh binding into the scope. Swift
elegantly disambiguates the two at the syntax level, by requiring a
leading . for enum variants...
Observations/Thoughts
2022-07-13
~7 min read
eli.thegreenplace.net
...fn main() -> Result<()> {
let config_dirs = get_configuration_directories()?;
match config_dirs.first() {
Some(cache_dir) => initialize_cache(cache_dir),
None => unreachable!("already checked that CONFIG_DIRS is non-empty"),
}
Ok(())
}
Once get_configuration_directories returns a successful result,
we are guaranteed that the vector isn't empty. And yet...
Observations/Thoughts
2026-09-30
~7 min read
helix-editor.com
...Reflow recognizes
matching prefixes between lines, so you may reflow line-comments, markdown
quotes or lines with leading whitespace and the leading characters will be
placed appropriately.
Swap windows
--:----:--
Windows may now be swapped with neighbor windows and splits may be transposed.
With the window menu open (C-w or...
Project/Tooling Updates
2022-06-01
~3 min read
rust-lang.github.io
...Patterns
Today, a static is allowed to be used in pattern matching. With the introduction of const, however, a static will be forbidden from appearing in a pattern match, and instead only a const can appear.
Drawbacks
This RFC introduces two keywords for global data. Global data is kind of...
RFC 246
RFC
2014-08-08
~8 min read