Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
...Chapter 6 covers enums, match expressions, and the if let and let...else control flow constructs. You’ll use structs and enums to make custom types. In Chapter 7, you’ll learn about Rust’s module system and about privacy rules for organizing your code and its public application programming...
The Rust Programming Language Book 2024-02-01 ~7 min read
blog.veeso.dev
...Command, desc: &str) -> Result<(), String> { println!("running {:?}", command); let status = command.status(); let verbose_error = match status { Ok(status) if status.success() => return Ok(()), Ok(status) => format!( "'{exe}' reported failure with {status}", exe = command.get_program().to_string_lossy() ), Err(failed) => match failed.kind() { std::io::ErrorKind::NotFound => format!( "Command...
Observations/Thoughts 2025-04-02 ~9 min read
rust-malaysia.github.io
...Penang) (Slides) 2019-11-13 Recording Rust Lang Meetup - November 2019 (News) Contributing to Rust by Ivan Tham (Slides) Rust 101 Struct, Enum, Pattern Matching (Easy) by Ivan Tham (Slides) 2019-09-11 Recording Rust Lang Meetup - September 2019 (News) Unit tests and benchmarks (Slides) (Code) by Ivan Tham 2019...
Virtual 2022-04-27 ~3 min read
lukaskalbertodt.github.io
...Which method to call? (An inherent method of a type? A method of a trait in scope?) How to coerce the receiver type to match the self type of the method? Not requiring the programmer to explicitly write out these details make method calls more convenient to use. However, this...
News & Blog Posts 2019-12-10 ~7 min read
github.com
...Instead of falling into one of these two categories, the compiler will instead disallow any references to statics by value (from other statics). ### 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...
RFC 246 RFC 2014-08-08 ~8 min read
www.possiblerust.com
...fn from(other: &FullUrl) -> Url<'_> { let scheme = Some(other.scheme()); let username = match other.username() { "" => None, u => Some(u), }; let password = other.password(); let host = other.host_str(); let path = Some(other.path()); let fragment = other.fragment(); let query = other.query(); Url { scheme, username, password, host, path, fragment, query, } } } impl...
Rust Walkthroughs 2021-02-03 ~12 min read
kevinlynagh.com
...type PinIdx = u8; type Port = u8; const COL_PINS: [(Port, PinIdx); 7] = [(1, 10), (1, 13), (1, 15), (0, 2), (0, 29), (1, 0), (0, 17)]; pub fn init_gpio() { for (port, pin_idx) in &COL_PINS { match port { 0 => { device.P0.pin_cnf[*pin_idx as usize].write(|w...
Observations/Thoughts 2021-03-10 ~22 min read
www.thecodedmessage.com
...Rust would use match for such an operation, putting all the information about it in one place: fn is_administrator(user: &UserId) -> bool { match user { UserId::Username(name) => name.starts_with("admin_"), UserId::AnonymousUser(_) => false, } } This yields a more complicated individual function, but it has all the logic explicitly right...
Observations/Thoughts 2023-02-08 ~21 min read
blog.adamant-lang.org
...Lifetime Annotations could be color-coded to match the lifetime line corresponding to them. Additionally, it might be possible to label the line with the lifetime name (for example 'a). Nested Functions can probably be treated similarly to regular functions, though there may be issues with the lifetime lines of...
News & Blog Posts 2019-02-19 ~7 min read
cuchi.me
...Creation) -> Result<Session, api::Error> { let res = api::build_base_request(context) .json(&CreateSession::build_query(creation)) .send() .await? .json::<Response<create_session::ResponseData>>() .await?; match res.data { Some(data) => Ok(Session { token: data.create_session.token, }), _ => Err(api::Error(api::get_error_message(res).to_string())), } } Neither of the...
Observations/Thoughts 2020-08-04 ~12 min read
freemasen.com
...IoError(std::io::Error, &'static str), } impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { // ... Self::IoError(inner, what) => write!(f, "Io Error parsing {}: {}", what, inner), } } } This is going to end up doing a lot of the same work that...
Rust Walkthroughs 2022-10-26 ~15 min read
github.com
...0 }; match t { Alias::Bar(_i) => {} Alias::Baz { i: _i } => {} } } ``` ## Reference-level explanation [reference-level-explanation]: #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...
RFC 2338 RFC 2018-02-15 ~3 min read
os.phil-opp.com
...Since the match self {…} statement is executed in a loop, the execution jumps to the WaitingOnFooTxt arm next: ExampleStateMachine::WaitingOnFooTxt(state) => { match state.foo_txt_future.poll(cx) { Poll::Pending => return Poll::Pending, Poll::Ready(content) => { // from body of `example` if content.len() < state.min_len { let bar_txt_future...
News & Blog Posts 2020-03-31 ~79 min read
github.com
...The primary proposal is arbitrary order, to match preexisting `BinaryHeap` iterators. ## Unresolved questions - Concrete shape of the `BTreeMap` API is not resolved here - Will closed ranges be used for the `drain` API?
RFC 1257 RFC 2015-08-14 ~3 min read
mainmatter.com
...You'll write your first extern "C" blocks by hand and see what you're promising the compiler when you declare a binding, and what goes wrong when the signature doesn't match.2Types and Data Across the BoundaryHow to move primitive values, strings, structs, and collections across the language...
Rust Walkthroughs 2026-07-01 ~3 min read
www.osohq.com
...fn isa(self, instance: &Instance, class_tag) { match class_tag { "Foo" => instance.is::<Foo>() ... } } fn get_attribute(self, instance: &Instance, attribute) { match self.instance_to_class[instance_id] { "Foo" => match attr { "x" => instance.downcast::<Foo>().x, ... } ... } } It's not entirely clear just how much can be done at compile time...
Learn More Rust 2020-10-21 ~12 min read
blog.getseq.net
...impl FnOnce() -> Self + UnwindSafe) -> Self { LAST_RESULT.with(|last_result| { { *last_result.borrow_mut() = None; } match catch_unwind(f) { Ok(flare_result) => { let extract_err = || flare_result.as_err().map(Into::into); // Always set the last result so it matches what's returned. // This `Ok` branch doesn't necessarily mean...
News & Blog Posts 2018-09-25 ~26 min read
insanitybit.github.io
...Serialize + Deserialize { let (snd, rcv) = ipc::channel().unwrap(); if let Fork::Parent(_) = fork().unwrap() { return match rcv.recv() { Ok(t) => SandboxResult::Ok(t), Err(_) => SandboxResult::Err, }; } for descriptor in self.descriptors.iter_mut() { descriptor.execute(); } snd.send(closure()).unwrap(); std::process::exit(0); } Fork into a child process, the child...
News & Blog Posts 2016-06-13 ~3 min read
blog.skylight.io
...That's it! We first convert the Ruby string into a "slice" type that Rust understands, call chars() on it to get an iterator, and use the .all() method to check if all the (unicode) characters matches the predefined whitespace rules using a closure. Finally, Rust implicitly returns the value...
News & Blog Posts 2016-05-16 ~21 min read
blog.image-rs.org
...More work was needed to match its performance, both due to differences in workloads (e.g. lots of very small images instead of a single large one) and in the hardware (e.g. low-end ARM chips in older Android phones). Compatibility and correctness required surprisingly little work. The library...
Project/Tooling Updates 2026-06-24 ~7 min read
"@ZiCog: Does anyone have a 'no holds barred, unsafe or not' solution to the problem in Rust that can match C? @kornel: Pipe the C version through c2r..."

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.