Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
deislabs.io
...Because recursion requires a concrete type that matches that trait bound, everything else in the whole call stack now had to match those specific concrete types. You can get around this with Boxing, but that is noisy and annoying. To be clear: this isn’t so much a problem to...
Observations/Thoughts 2020-12-16 ~15 min read
www.5snb.club
...u8) -> u8 { match x { b'0'..=b'9' => x - b'0', b'a'..=b'f' => x + 10 - b'a', _ => panic!("unknown character"), } } const fn hl_to_u8(h: u8, l: u8) -> u8 { hex_to_u4(h) << 4 | hex_to_u4(l) } impl const constinto::ConstPanickingFrom<&str> for Color { fn const...
Miscellaneous 2020-09-30 ~7 min read
www.viget.com
...u32, } impl Future for MyFuture { type Output = i32; fn poll(&mut self, ctx: &Context) -> Poll<Self::Output> { match self.count { 3 => Poll::Ready(3), _ => { self.count += 1; ctx.waker().wake(); Poll::Pending } } } } Let's go over this line by line: #[derive(Default)] automatically creates a ::default() function for the type...
News & Blog Posts 2019-04-02 ~8 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
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
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
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
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
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
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
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
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
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
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
doc.rust-lang.org
...Note that we do not perform coercions when matching traits (except for receivers, see the next page). If there is an impl for some type U and T coerces to U, that does not constitute an implementation for T. For example, the following will not type check, even though it...
The Rustonomicon Book 2024-01-01 ~1 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
"Now macros are fine, I mean we use them for implementing internals and you know if you have something that \[...\] needs to be implemented for lots an..."

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.