Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
geeklaunch.io
...u32 = match Some(1) { Some(x) => x, None => return, // `return` is of type never };Although the syntax is still experimental, the never type is denoted with the exclamation mark !. In the meantime, you can use Infallible as an alternative.The never type can be useful when implementing a trait that...
Rust Walkthroughs 2023-02-22 ~5 min read
bitbucket.org
...The second and third statements identify the file or blob by matching magic numbers. In all three cases, the result is the string "image/jpeg". char *mimetype = mimty_file("appendix/samples/cat.jpg"); char *mimetype = mimty_file("appendix/samples/cat"); char *mimetype = mimty_blob(((uint8_t [3]) {0xff, 0xd8, 0xff...
New Releases & Project Updates 2015-06-29 ~1 min read
blog.implrust.com
...u8 = 0b100; fn read_ack(&mut self) -> Result<(), SwdError> { match self.read_bits(3) as u8 { ACK_OK => Ok(()), ACK_WAIT => Err(SwdError::Wait), ACK_FAULT => Err(SwdError::Fault), ack => Err(SwdError::InvalidAck(ack)), } } Reading a RegisterBefore reading the register, we need a small helper to put SWDIO into the...
Rust Walkthroughs 2026-09-16 ~15 min read
blog.orhun.dev
...It is because we allowed Option types by removing the serde attribute so we should update the generic parameter from String to Option<String> in our expected claims data in the script: - match VerifyWithKey::<Token<Header, BTreeMap<String, String>, _>>::verify_with_key( + match VerifyWithKey::<Token<Header, BTreeMap<String, Option<String...
Observations/Thoughts 2022-04-27 ~11 min read
rust-lang.github.io
...Some solutions: • Punctuation(char) with special rules for pattern matching tokens, • Punctuation([char]) with a facility for macros to split tokens. Tokenising could match the maximum number of punctuation characters, or use the rules for the current token set. The former would have issues with pattern matching. The latter is...
RFC 1566 RFC 2016-02-15 ~16 min read
hermanradtke.com
...To get usable results from our parser, we must convert (or map) a matched sequence of bytes into the type that we want. Knowing this, let us start looking at how to parse text input. The bread and butter of our parsing is going to be the use of the...
News & Blog Posts 2016-08-09 ~5 min read
siciarz.net
...We can match on its variants to handle both the happy path and error cases in a very explicit, if not verbose, way. To address the verbosity, there was a try! macro that cut down on a lot of pattern matching boilerplate. And as of now we have an even...
24 Days of Rust 2016-12-20 ~5 min read
academy.fpblock.com
...Sum types of records Rust's enum system, particularly when combined with pattern matching, feels more robust than Haskell's sum types of records. When defining sum types of records in Haskell, there is a possibility of introducing partial record accessors which can cause runtime crashes, though recent versions of...
Miscellaneous 2025-07-02 ~13 min read
dev.to
...Name) { match name { Name::Empty => println!("Hello, {}!", Name::default()), Name::Is(value) => println!("Hello, {}!", value), } } greet_name(Name::Empty); greet_name(Name::Is(String::from("Ferris"))); // Hello, world! // Hello, Ferris! Enter fullscreen mode Exit fullscreen mode I personally prefer the third approach for its readability, but it requires some work...
Learn Standard Rust 2020-09-23 ~2 min read
mary.codes
...let n = &doc.resolve_reference(&node); // Matches the node by reference and then generates coordinates. match n { osm::Reference::Node(node) => { let point = process_points(node, &bounds, width, height); coords.push(&point); }, _ => {} } } coords } I need to call this function from process_ways. #[wasm_bindgen] pub fn process_ways(text: String...
Rust Walkthroughs 2024-02-21 ~15 min read
rust-lang.github.io
...Generic associated consts in match patterns It seems desirable to allow constants that depend on type parameters in match patterns, but it's not clear how to do so while still checking exhaustiveness and reachability of the match arms. Most likely this requires new forms of where clause, to constrain...
RFC 195 RFC 2014-08-04 ~36 min read
tokio.rs
...Value::Structable(v) => v.visit(self), // Ignore other patterns _ => {} } } fn visit_named_fields(&mut self, named_values: &NamedValues<'_>) { // We only care about `accept_encoding` match named_values.get_by_name("accept_encoding") { Some(Value::Listable(accept_encoding)) => { // Create the `VisitAcceptEncoding` instance to visit // the items in `Listable`. let mut visit...
Project/Tooling Updates 2021-05-26 ~5 min read
www.rismosch.com
...Job) -> Result<(), BlockedOrFull> { let head = unsafe { &mut *self.head.get() }; let mutnode = match self.jobs[*head].try_lock() { Ok(node) => node, Err(std::sync::TryLockError::WouldBlock) => { return Err(BlockedOrFull { not_pushed: job }) } Err(std::sync::TryLockError::Poisoned(e)) => throw!("mutex is poisoned: {}", e), }; match *node { Some(_) => Err(BlockedOrFull { not_pushed...
Rust Walkthroughs 2022-10-12 ~44 min read
blog.yossarian.net
...bitstream blocks that describe an LLVM module may themselves contain a BLOCKINFO block, which in turn can define multiple abbreviations for any subsequent blocks that match the block IDs specified by the BLOCKINFO. If all of this indirection and abbreviation wasn’t complicated enough, the bitstream container format uses three...
Rust Walkthroughs 2021-08-18 ~9 min read
pker.xyz
...Vec<CString> = vec![cmd.clone()]; argv.extend(args.iter().map(|a| CString::new(a.as_str()).unwrap())); match execvp(&cmd, &argv) { Ok(void) => match void {}, Err(e) => panic!("execvp failed: {e}"), } } } } The child calls traceme() then execvp. The exec generates a SIGTRAP that stops the child, and the parent picks...
Project/Tooling Updates 2026-02-18 ~15 min read
doc.rust-lang.org
...Only the test with the name one_hundred ran; the other two tests didn’t match that name. The test output lets us know we had more tests that didn’t run by displaying 2 filtered out at the end. We can’t specify the names of multiple tests in...
The Rust Programming Language Book 2024-02-01 ~5 min read
lupyuen.github.io
...Finally we match the result returned by the C function: 0 for success, non-zero for error… // Check the result code match res { 0 => Ok(()), // If no error, return OK _ => Err(res) // Else return the result code as an error } } “match” works like “switch...case” in C. (“_” matches anything, similar...
Miscellaneous 2021-04-21 ~25 min read
seanmonstar.com
...In doing so, it expresses a strong opinion, which might not match your previous experiences, but I believe it manages to do something really special. I’m super excited to reveal warp, a joint project with @carllerche. Background What makes warp different? I’ve been working on web servers for...
News & Blog Posts 2018-08-07 ~5 min read
doc.rust-lang.org
...We switched from if to match now that we have three cases. We need to explicitly match on a slice of request_line to pattern-match against the string literal values; match doesn’t do automatic referencing and dereferencing, like the equality method does. The first arm is the same...
The Rust Programming Language Book 2024-02-01 ~23 min read
notes.iveselov.info
...Why? I don't know for sure, but I suspect that we may want to do certain lookaheads while parsing and this means invoking the closure and then backtracking if it doesn't match. But this mean we would have spoiled the parser closure and can't use it again...
News & Blog Posts 2020-07-21 ~5 min read
"It’s *enjoyable* to write Rust, which is maybe kind of weird to say, but it’s just the language is fantastic. It’s fun. You feel like a magician..."

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.