Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
...AliasedResult<i32>) { match result { Ok(n) => println!("n is {}", n), Err(e) => println!("Error: {}", e), } } fn main() { print(multiply("10", "2")); print(multiply("t", "2")); } See also: io::Result
Rust by Example Book 2024-01-01 ~1 min read
rust-analyzer.github.io
...t responsible for variant pattern completions. #8028 prepare for returning parents in the "Locate parent module" command. #8039 use SmallVec for Substs. #8046 add match vs. if let …​ else entry to the style guide. #8034 implement Crate::transitive_reverse_dependencies. #8042 (first contribution) add rustc-perf version to the metrics...
Project/Tooling Updates 2021-03-24 ~1 min read
danielwelch.github.io
...Json<PushEvent>) -> impl Responder { let travis_url = env::var("TRAVIS_URL").unwrap(); if push.reference.ends_with("master") { match travis_request("https://api.travis-ci.org/repo/19145006/requests") { Ok(_) => ServerMessage(format!( "PushEvent on branch master found, request sent to {}", travis_url).to_owned()), Err(e) => ErrorInternalServerError(e), } } else { ServerMessage...
News & Blog Posts 2018-06-05 ~7 min read
diziet.dreamwidth.org
...Parseable + Default { match self.end { Ok(match self.end { LinkEnd::Client => self.ordinary(key, skl)?, LinkEnd::Client => self.ordinary(key, skl)?, LinkEnd::Server => default(), LinkEnd::Server => default(), } }) … … Return value and Ok(()) entirely replaced by #[throws]: impl Display for Loc { impl Display for Loc { #[throws(fmt::Error)] fn fmt(&self, f...
Observations/Thoughts 2022-12-21 ~13 min read
slawlor.github.io
...Self::Msg, _state: &mut Self::State) -> Result<(), ActorProcessingErr> { match message { MyFirstActorMessage::PrintHelloWorld => { println!("Hello world!"); } } Ok(()) } } Ok now that looks better! Here we’ve added the message handler handle() method which will be executed for every message received in the queue. All together nowPermalink Let’s wire it all up...
Project/Tooling Updates 2024-11-06 ~5 min read
encore.dev
...When the bytes match, our server is answering the way the reference implementation does. Running the reference suite this way surfaced differences that would be easy to miss otherwise. One of them was in how expiry is tested, where the suite advances a mock clock to check that keys expire...
Observations/Thoughts 2026-07-01 ~5 min read
blog.shortepic.com
...impl Display for Square { fn fmt(&self, f: &mut Formatter<'_>) -> Result { let s = match self { Square::Empty => "", Square::X => "X", Square::O => "O", }; write!(f, "{}", s) } } impl Display for Status { fn fmt(&self, f: &mut Formatter<'_>) -> Result { let s = match self { Status::Playing => "Next player: ", Status::Won => "Winner: ", }; write!(f...
Learn More Rust 2020-10-07 ~5 min read
blog.getreu.net
...impl<B: ?Sized + ToOwned> Clone for Cow<'_, B> { fn clone(&self) -> Self { match *self { Borrowed(b) => Borrowed(b), Owned(ref o) => { let b: &B = o.borrow(); Owned(b.to_owned()) } } } With the last line (Owned(b.to_owned())) it becomes clear, why an owned Cow variant results in a deep...
Rust Walkthroughs 2024-11-06 ~3 min read
doc.rust-lang.org
...If next returns Some, we use a match to extract the value. If it returns None, it means not enough arguments were given, and we return early with an Err value. We do the same thing for the file_path value. Clarifying Code with Iterator Adapters We can also take...
The Rust Programming Language Book 2024-02-01 ~5 min read
christian.amsuess.com
...W) -> Result<(), W::Error> { let chunk = self.data.view(request_data.block); match chunk { Ok((payload, option)) => { message.set_code(code::Content); message.add_opaque_option(option::ETag, &self.etag)?; message.add_block_option(option::Block2, option); message.add_payload(payload)?; } Err(_) => { message.set_code(code::BadRequest); } }; Ok(()) } As these...
Call for Blog Posts 2020-09-30 ~5 min read
www.evanmiller.org
...Like if, match is an expression, not a statement, so it can be used as an rvalue. But unlike if, match doesn’t suffer from the phantom-else problem. The compiler uses type-checking to guarantee that the match will match something — or speaking more precisely, the compiler will complain...
Notable Links 2015-05-18 ~35 min read
stace.dev
...if let Some(answer) = get_answer(&response) { match answer { DnsRecord { data: DnsRecordData::Ipv4Addr(ip), type_: TYPE_A, .. } => return Ok(*ip), DnsRecord { data: DnsRecordData::Name(name), type_: TYPE_CNAME, .. } => return resolve(name, TYPE_A), _ => { panic!("resolve: something went wrong") } } } Using match to destructure the data enum based on a DNS record...
Observations/Thoughts 2023-07-19 ~5 min read
blog.viraptor.info
...It doesn’t support regex matching or casting parameters to the right type, but it’s functional. Same goes for logging and static file handling. No thrills, they work. There aren’t that many template libraries to choose from yet, but handlebars-iron does the job. The feeling that when...
Notable Links 2015-06-07 ~7 min read
rust-lang-nursery.github.io
...The path! macro is used to define what URL matches. The :query is a template — it matches anything and stores the value as query for the component to read later. <A> anchors links while <Routes fallback=...> is used to provide a default. More in the Leptos book: Defining <Routes/> and...
The Rust Cookbook Book 2024-01-01 ~3 min read
mtigley.dev
...action_status is an immutable referencee to the player object’s associated ActionStatus component, which we will use to match on its action_type property:match action_status.action_type { Action::Idle => { sprite.sprite_number = animation.first_sprite_index + frame as usize; }, Action::Run => { // The first running animation is the...
Learn More Rust 2020-08-26 ~7 min read
flodl.dev
...Recurrent — full sequence modules, not just cells: // Multi-layer GRU matching nn.GRU exactly let gru = GRU::new(128, 256, 2)?; // 2 layers let (output, h_n) = gru.forward_seq(&x, None)?; // Multi-layer LSTM matching nn.LSTM let lstm = LSTM::new(128, 256, 2)?; let (output, (h_n, c...
Project/Tooling Updates 2026-04-01 ~5 min read
rust-lang-nursery.github.io
...badge]][csv] | [![cat-encoding-badge]][cat-encoding] | | Read CSV records with different delimiter | [![csv-badge]][csv] | [![cat-encoding-badge]][cat-encoding] | | Filter CSV records matching a predicate | [![csv-badge]][csv] | [![cat-encoding-badge]][cat-encoding] | | Handle invalid CSV data with Serde | [![csv-badge]][csv] [![serde-badge]][serde] | [![cat-encoding-badge...
The Rust Cookbook Book 2024-01-01 ~1 min read
rust-lang.github.io
NA
...High-level summary: • several unnecessary uses of repr(packed) (patches have been submitted and merged to remove all of these) • most necessary ones are to match the declaration of a struct in C • many "necessary" uses can be replaced by byte arrays/arrays of smaller types • 8 crates are currently...
RFC 1240 RFC 2015-08-06 ~10 min read
minikin.me
...TrafficLightEvent) -> TrafficLightState { match (self, event) { // Normal cycle (TrafficLightState::Red, TrafficLightEvent::Timer) => TrafficLightState::Green, (TrafficLightState::Green, TrafficLightEvent::Timer) => TrafficLightState::Yellow, (TrafficLightState::Yellow, TrafficLightEvent::Timer) => TrafficLightState::Red, // Emergency override (_, TrafficLightEvent::Emergency) => TrafficLightState::Red, } } } // Usage fn main() { let mut state = TrafficLightState::Red; println!("Initial state: {:?}", state); // Normal cycle state = state.next(TrafficLightEvent::Timer...
Rust Walkthroughs 2025-03-19 ~22 min read
arzg.github.io
...Let’s add an is_trivia method to SyntaxKind to abstract away this behaviour:impl SyntaxKind { pub(crate) fn is_trivia(self) -> bool { matches!(self, Self::Whitespace | Self::Comment) } } Note how the method takes self; this is because it’s more efficient to pass SyntaxKind by value instead of by...
Rust Walkthroughs 2020-12-16 ~3 min read
"Spent the last week learning rust. The old martial arts adage applies. Cry in the dojo, laugh in the battlefield."

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.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
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.