docs.rs
...The macro takes in a token stream and for each token that matches a given predicate it replaces that token with a given replacement sequence of tokens. For example the caller may want to replace the token self with the single token __value . The rule shown here is responsible for...
Crate
v1.0.9
2022-12-19
huonw.github.io
...1
2
3
trait Foo {
fn method(&self, other: &Self);
}
The types of the two arguments have to match, but this can’t be
guaranteed with a trait object: the erased types of two separate
&Foo values may not match:
1
2
3
4
5
impl<'a> Foo for Foo...
Blog Posts
2015-01-12
~9 min read
developerlife.com
...fn main() {
let args = args().collect::<Vec<String>>();
with(run(args), |it| match it {
Ok(()) => exit(0),
Err(err) => {
eprintln!("{}: {}", style_error("Problem encountered"), err);
exit(1);
}
});
}
fn run(args: Vec<String>) -> Result<(), Box<dyn Error>> {
match is_stdin_piped() {
true => piped_grep(PipedGrepOptionsBuilder::parse(args)?)?,
false => grep(GrepOptionsBuilder::parse...
Rust Walkthroughs
2023-05-17
~6 min read
casualhacks.net
Archived: primary link replaced with an archive on 2026-09-12T11:37:27.492Z (UTC; replacement date, not snapshot date)
...let x = match 42 {
_tmp1 => match foo!(_tmp1, arg) {
_tmp2 => baz!(_tmp2, a: 13)
}
};
Provide the evaluated self as the first argument (captured as an opaque expr fragment) to the macro and pass any additional tokens to the macro. This syntactic sugar is not to allow the macro to inspect...
Call for Blog Posts
2020-10-07
~7 min read
rustc-dev-guide.rust-lang.org
...Add your variant to the match in rustc_hir/attrs/encode_cross_crate.rs, which should return whether your attribute should be visible in dependent crates. This is usually No for code-gen related attributes, and Yes for analysis related attributes.
4. Create a new struct in rustc_attr_parsing...
Guide to Rustc Development
Book
2024-01-01
~4 min read
pzol.github.io
...let mut map = HashMap::<~str, uint>::new();
map.insert(~"foo", 1);
let s = match map.find(&~"foo") {
None => 0,
Some(v) => *v
};
As in get_copy you can use find_copy instead of find
let mut map = HashMap::<~str, uint>::new();
map.insert(~"foo", 1);
let r = match map.find...
Announcements, etc
2014-02-15
~6 min read
www.azabani.com
...It’s not a bad convention too — the unobtrusive dots for C0 controls and high bytes make ASCII text stand out, as if you had installed strings(1) on your pattern-matching neurons.
But imagine what kinds of patterns you could spot in binary data, if only there was a...
Project Updates
2020-11-18
~4 min read
docs.rs
...a bare byte-oriented x25519 function which matches the function specified in RFC7748 , as well as a higher-level Rust API for static and ephemeral Diffie-Hellman. Examples Alice and Bob are two adorable kittens who have lost their mittens, and they wish to be able to send secret messages...
Crate
v3.0.0
2026-07-06
fasterthanli.me
...15 | match dri {
| ^^^ pattern `&Juice` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&Drink`
The compiler suggests two possible fixes, either add a wildcard:
fn print_drink(dri: &Drink) {
match dri {
Drink...
Learn More Rust
2020-09-09
~61 min read
blog.piston.rs
...Button::new()
.react(|event| match event {
button::Event::Pressed(mouse_button) => /* react to press, may get called multiple times */,
button::Event::Released(mouse_button) => /* react to release, may get called multiple times */,
button::Event::Clicked(mouse_button) => /* react to click, may get called multiple times */,
})
.set(ID, &mut ui);
There...
New Crates & Project Updates
2016-09-13
~9 min read
javierviola.com
...PlayerId = req.query().unwrap_or_default();
let state = req.state().clone();
let petnames = Petnames::default();
let player_id = match client.id {
Some( id ) => id,
None => petnames.generate_one(2, ".")
};
let player = Player {
id : PlayerId {id : Some(player_id.clone())},
wsc : wsc.clone(),
label: String::from("")
};
match state.add_player_to...
Rust Walkthroughs
2021-02-03
~11 min read
xnacly.me
...node[],
39 -- }
40 --```
41 --
42 hook = function(node)
43 if node.kind == "ident" then
44 if string.match(node.content, "%u") then
45 -- returing an error passes the diagnostic to sqleibniz,
46 -- thus a pretty message with the name of the hook, the
47 -- node it occurs and the message...
Observations/Thoughts
2024-12-25
~9 min read
rust-lang.github.io
...Note that this can only be done with a compiler that already supports i128/u128 to match the calling convention that LLVM is expecting.
Here is the list of functions that need to be implemented:
fn __ashlti3(a: i128, b: i32) -> i128;
fn __ashrti3(a: i128, b: i32) -> i128;
fn...
RFC 1504
RFC
2016-02-21
~4 min read
arxiv.org
...Among its design principles, Rust is aimed at matching C in terms of efficiency, but with increased code security and productivity. This paper presents a comparative study between C and Rust in terms of performance and programming effort, selecting as a case study the simulation of N computational bodies (N...
Research
2021-07-28
~1 min read
arXiv
arxiv.org
...Notably, none of the automated techniques consistently match or exceed human-written translations across all quality dimensions, yet even human-written Rust code exhibits persistent internal quality issues such as readability and non-idiomatic patterns. Together, these findings show that translation quality remains a multi-dimensional challenge, requiring systematic evaluation...
Software Engineering
Biruk Tadesse, Vikram Nitin, Mazin Salah et al.
2026-01-31
arXiv:2602.00840
crates.io
...The user-space kernel API is often API-incompatible with the kernel space one, and even in the cases where they match, they are sometimes ABI incompatible such that using this library would have undefined behavior . Usage Add the following to your Cargo.toml to conditionally include mach on those...
Crate
v0.3.2
2019-06-01
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly