Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
hoverbear.org
...std::time::Duration::new(0, 0) } } } fn to_filling(&mut self) { self.state = match self.state { State::Waiting { .. } => State::Filling { rate: 1 }, _ => panic!("Invalid state transition!"), } } } fn main() { let mut state_machine = StateMachine::new(); state_machine.to_filling(); } At first glance it seems okay. But notice some problems? Invalid transition...
Blog Posts 2016-10-18 ~18 min read
hoverbear.org
...std::time::Duration::new(0, 0) } } } fn to_filling(&mut self) { self.state = match self.state { State::Waiting { .. } => State::Filling { rate: 1 }, _ => panic!("Invalid state transition!"), } } } fn main() { let mut state_machine = StateMachine::new(); state_machine.to_filling(); } At first glance it seems okay. But notice some problems? Invalid transition...
Rust Walkthroughs 2025-04-16 ~18 min read
docs.rs
...I run async every 7 seconds"); // Query the next execution time for this job let next_tick = l.next_tick_for_job(uuid).await; match next_tick { Ok(Some(ts)) => println!("Next time for 7s job is {:?}", ts), _ => println!("Could not get next tick for 7s job"), } }) })? ).await?; // Needs the...
Crate v0.15.1 2025-10-28
blogsystem5.substack.com
...c_uint, }It is very important to declare the structure as having a C representation so that its memory layout matches what the C compiler produces for the same structure. The kernel expects C semantics in its system call boundary, and we must adhere to that. Additionally, we must ensure...
Rust Walkthroughs 2025-02-19 ~14 min read
www.lpalmieri.com
...web::Data<PgPool>, ) -> HttpResponse { let name = match SubscriberName::parse(form.0.name) { Ok(name) => name, // Return early if the name is invalid, with a 400 Err(_) => return HttpResponse::BadRequest().finish(), }; let new_subscriber = NewSubscriber { email: form.0.email, name, }; match insert_subscriber(&pool, &new_subscriber).await { Ok(_) => HttpResponse::Ok().finish...
Rust Walkthroughs 2020-12-16 ~31 min read
blog.digital-horror.com
...Vec<String> = domains.into_iter().map(|x| x.to_owned()).collect(); match mode { EnrichmentMode::DnsLookup => { // Ignore for now } EnrichmentMode::MxCheck => { // Ignore for now } _ => return Err("enrichment mode not yet implemented"), } Ok(domain_store) }https://github.com/JuxhinDB/twistrs/blob/ddc6facfeae818ea15a523d9a1e9fb04ce3e61fd/src/lib.rs#L601-L632The more astute reader might also...
Learn More Rust 2020-09-09 ~14 min read
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
blog.arnedebo.com
...bind_slice! can be used to store a borrowed reference of whatever was matched inside into a bucket. Parsing function signatures # We will now move to a slightly larger example, parsing a function signature grammar looking like this: IDENT = 'a'..'z', { 'a'..'z' | '0'..'9' } ; FN_SIGNATURE = 'fn', WHITESPACE, IDENT...
Rust Walkthroughs 2026-06-03 ~9 min read
rustc-dev-guide.rust-lang.org
...fn foo() {} fn bar() {} let a = match my_bool { true => foo, true if other_bool => foo, false => bar, } In this example when type checking the match expression a LUB coercion is performed. This LUB coercion starts out with an initial lub ty of some inference variable ?x due to the...
Guide to Rustc Development Book 2024-01-01 ~12 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
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
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
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
"I wrote a bespoke time-series database in Rust a few years ago, and it has had exactly one issue since I stood it up in production, and that was due t..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.