Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
jordankaye.dev
...u32) -> Self { 15 match self { 16 Self::Empty => Self::SingleDigit(val), 17 Self::SingleDigit(a) => Self::DoubleDigit(a, val), 18 Self::DoubleDigit(a, _) => Self::DoubleDigit(a, val), 19 } 20 } 21 22 pub fn extract(self) -> u32 { 23 match self { 24 Self::SingleDigit(a) => a * 10 + a, 25 Self::DoubleDigit(a...
Observations/Thoughts 2024-01-03 ~34 min read
hugopeters.me
...We store them in an 8x8 matrix to match the layout of the board. We also add the constraint that the value must be in the range [1,8]. let mut board = Vec::new(); for y in 0..8 { let mut row = Vec::new(); for x in 0..8 { let...
Observations/Thoughts 2024-05-01 ~6 min read
kerkour.com
...While in Rust, a non-exhaustive match produces a compile-time error: #[derive(Debug, Clone, Copy)] enum Platform { Linux, MacOS, Windows, Unknown, } impl fmt::Display for Platform { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Platform::Linux => write!(f, "Linux"), Platform::Macos => write!(f, "macOS"), // Compile time...
Observations/Thoughts 2026-04-01 ~6 min read
m4rw3r.github.io
...I| { let m = i.mark(); match f.parse(i) { (b, Ok(d)) => (b, Ok(d)), (b, Err(_)) => g.parse(b.restore(m)), } } } It is almost identical to the monad-like definition: pub fn or<I: Input, T, E, F, G>(i: I, f: F, g: G) -> ParseResult<I, T, E...
News & Blog Posts 2016-08-30 ~5 min read
doc.rust-lang.org
...It is undefined behavior to (unsafely) construct an instance of an enum that does not match one of its variants. (This allows exhaustive matches to continue to be written and compiled as normal.) repr(transparent) #[repr(transparent)] can only be used on a struct or single-variant enum that has...
The Rustonomicon Book 2024-01-01 ~6 min read
github.com
...The lint `trivial_constraints` would be added, matching the pre-1.7 semantics of E0193, and would be set to warn by default. [`E0193`]: https://doc.rust-lang.org/error-index.html#E0193 ## How We Teach This [how-we-teach-this]: #how-we-teach-this This feature does not need...
RFC 2056 RFC 2017-07-05 ~2 min read
www.willusher.io
...let addr = (&host[..], worker::PORT).to_socket_addrs().unwrap().next().unwrap(); // Use mio's TcpStream to connect to the worker, if we succeed in starting the // connection add this stream to the event loop match TcpStream::connect(&addr) { Ok(stream) => { // Each worker is identified in the event loop by their...
News & Blog Posts 2016-01-04 ~25 min read
kerkour.com
...Q, user: &User) -> Result<(), Error> { const QUERY: &str = "INSERT INTO users (id, email) VALUES ($1, $2)"; sqlx::query(QUERY) .bind(user.id) .bind(&user.email) .execute(db) .await .map_err(|err| match err { sqlx::Error::Database(db_err) if db_err.constraint().is_some() => Error::EmailAlreadyInUse, err => Error::Unspecified(format...
Observations/Thoughts 2026-08-12 ~9 min read
lab.whitequark.org
...1 2 3 4 5 6 7 8 9 10 11 12 13 pub enum Address { Invalid, Ipv4([u8; 4]) } impl Address { pub fn is_invalid(&self) -> bool { match self { &Address::Invalid => true, _ => false } } } The API should: Permit reading addresses; Permit replacing addresses; Permit appending addresses, if used with a...
News & Blog Posts 2016-12-20 ~14 min read
guillaumegomez.github.io
...refer to add_two as “tested function”. @ConnyOnny updted match enum warning in The Book. @Wilfred added missing URL to release notes. @Eijebong fixed minor typo. @utkarshkukreti replaced all try! with ? in documentation examples. @GuillaumeGomez added missing urls for OsStr and OsString, forced backline on all where in docs, removed...
Other Weeklies from Rust Community 2017-01-31 ~2 min read
lwn.net
...The kernel API makes lock implementations matching that convention available. For example, a Mutex actually contains the data that it protects, so that it can ensure all accesses to the data are made with the Mutex locked. Since C code doesn't tend to work like this, the kernel's...
Project/Tooling Updates 2025-07-23 ~10 min read
guillaumegomez.github.io
...a dereference. @mikhail-m1 improved “Doesn’t live long enough” error. @liigo marked unsafe fns in module page with superscript icons in rustdoc. @xfix matched guessing game output to newest language version. @steveklabnik made it clear that the reference isn’t normative. @joshtriplett documented convention for using both fmt::Write...
Other Weeklies from Rust Community 2016-11-08 ~2 min read
bitrust.octarineparrot.com
...SomeType = ...; match foo { SOME_CONST => ... } ``` Another good option is to rewrite the match arm to use an `if` condition (this is also particularly good for floating point types, which implement `PartialEq` but not `Eq`): ```rust match foo { c if c == SOME_CONST => ... } ``` Finally, a third alternative is to tag the...
What 2014-12-08 ~46 min read
fengsp.github.io
...fn search(request: &mut Request) -> PencilResult { let keyword = match request.args().get("q") { Some(q) => q as &str, None => "", }; Ok(Response::from(format!("You are searching for {}", keyword))) } fn main() { // app here app.get("/search", "search", search); } Before/After Request extern crate typemap; use typemap::Key; struct KeyType; struct Value...
Notable New Crates & Project Updates 2016-03-14 ~2 min read
www.sea-ql.org
...how do you actually enforce those rules against SQL queries? With an external library, we still need to analyze raw SQL statements ourselves and match that up with the rule definitions. By embedding RBAC directly into SeaORM, we can analyze all queries and enforce those rules. Lightweight and performant Because...
Project/Tooling Updates 2025-10-01 ~9 min read
dev.to
...Comic::print This should be a simple addition, all we need to do is match on the OutFormat and print the Comic representation appropriately. Let's stub that out: impl Comic { // .. snip fn print(&self, of: OutFormat) -> Result<()> { match of { OutFormat::Text => println!("{}", todo!("print self as Text")), OutFormat::Json...
Rust Walkthroughs 2021-01-06 ~17 min read
www.thecodedmessage.com
...let input = match from_slice(&input) { Ok(parsed_value) => parsed_value, // This is the parsed value, type `Value` Err(_) => input, // This is the raw `Vec<u8>` data... TYPE MISMATCH! } We are then forced to brainstorm another solution, which might raise ideas we didn’t otherwise consider, and force us to...
Rust Walkthroughs 2022-09-21 ~6 min read
www.hacklewayne.com
...It doesn't stop here, pattern matching / case split takes another form, match (a, b) { (None, None) => "Both missing", (_, _) => "Something is there", } Come on, make up your mind! (Ok I am sure there are good reasons for these decisions but seriously was it really necessary to be this confusing?) closure...
Rust Walkthroughs 2022-03-02 ~10 min read
lwn.net
...The if let syntax matches x against the pattern Some(v), binding the name v to the SleepOnDrop value inside x whenever one is present. The else clause applies when x is None. Put together, the function is just an elaborate way to write the identity function: it returns whatever...
Project/Tooling Updates 2025-10-01 ~10 min read
www.florianreinhard.de
...We will encrypt a small „Hello World!“ message, give it a rough sanity check, and then we decrypt it back and hope, that the decrypted output matches our input. Under ./tests/features, please create the file encryptor.feature. The containing test specification should roughly look like this: Feature: Encrypt messages...
Learn Simple Rust 2020-09-30 ~10 min read
"I'm pretty sure I'm the only person ever to single handedly write a complex GPU kernel driver that has never had a memory safety kernel panic bug (its..."

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.