Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
smallcultfollowing.com
...In particular, types that implement Debug will prefer impl I.Another way to express the rule is to say that impls can specialize one another in two ways:if the types matched by one impl are a subset of the other, ignoring where clauses altogether;otherwise, if the types matched...
Blog Posts 2016-10-25 ~17 min read
jyn.dev
...Enums without pattern matching are very painful to work with and pattern matching without enums has very odd semantics Result and Iterators are impossible to implement without generics (or duck-typing, which I think of as type-erased generics) Send/Sync, and the preconditions to println, are impossible to encode...
Observations/Thoughts 2025-08-27 ~7 min read
doc.rust-lang.org
...They’re faster than you might think!) We’ve already covered some other Rust features, such as pattern matching and enums, that are also influenced by the functional style. Because mastering closures and iterators is an important part of writing fast, idiomatic, Rust code, we’ll devote this entire chapter...
The Rust Programming Language Book 2024-02-01 ~1 min read
www.ncameron.org
...The first rename matches, so we rename to x[4](), then we add the two marks: x[4](1, 2). Neither of the later two renames match, so we end up with the resolved name x[4]. Now consider y[2]. In this case the first rename does not match...
News & Blog Posts 2015-11-09 ~11 min read
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
doc.rust-lang.org
pub trait Index<Idx>
...Nucleotide) -> &Self::Output { match nucleotide { Nucleotide::A => &self.a, Nucleotide::C => &self.c, Nucleotide::G => &self.g, Nucleotide::T => &self.t, } } } let nucleotide_count = NucleotideCount {a: 14, c: 9, g: 10, t: 12}; assert_eq!(nucleotide_count[Nucleotide::A], 14); assert_eq!(nucleotide_count[Nucleotide::C], 9); assert_eq!(nucleotide...
trait core Stable since 1.0.0 Version 1.100.0-nightly
docs.rs
...InitState> I => BuilderField<I, T> } // matching on the type-level `InitState` enum by using `InitWit`. // `WITNESS` comes from the `HasTypeWitness` trait match I::WITNESS { // `te: TypeEq<FooInit, Init>` InitWit::InitW(te) => { te.map(HelperFn::NEW) //: TypeEq<BuilderField<I, T>, T> .to_right(maybe_init) } InitWit::UninitW(_) => else_(), } } // Emulates a type...
Crate v1.15.2 2026-04-14
www.jessestuart.ca
...Next up was considering using an enum with all the possible trait implementors, but then I’d have to match the concrete type for every operation which very quickly gets too complex. The use case involved composing all the implementors of the aforementioned trait to act as a single implementor...
Observations/Thoughts 2025-10-15 ~5 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
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
docs.rs
...ip_address = Ipv6Addr::new(0x2001, 0xdb8, 0xdead, 0xbeef, 0, 0, 0, 0x1); assert_eq!(table.insert(network.clone(), "foo"), None); // Get value for network from table assert_eq!(table.longest_match(ip_address), Some((network, &"foo"))); Minimal required version of Rust compiler is 1.31 (because of ip_network crate).
Crate v0.2.0 2021-07-12
docs.rs
...by default. .stdout(stdout) // Redirect stdout to `/tmp/daemon.out`. .stderr(stderr) // Redirect stderr to `/tmp/daemon.err`. .privileged_action(|| "Executed before drop privileges"); match daemonize.start() { Ok(_) => println!("Success, daemonized"), Err(e) => eprintln!("Error, {}", e), } } License Licensed under either of Apache License, Version 2.0 ( LICENSE-APACHE or http...
Crate v0.5.0 2023-02-25
crates.io
...These are situations where matching Rust's ownership and lifetime rules can get tricky. It doesn't make sense to use shared ownership with interior mutability (i.e. Rc<RefCell<T>> or Arc<Mutex<T>> ) nor borrowed references (ie &'a T or &'a mut T ) for structures. The cycles rule...
Crate v0.2.9 2023-05-22
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
docs.rs
...It will individually compile each of the source files matching the glob pattern, expect them to fail to compile, and assert that the compiler's error message matches an adjacently named *.stderr file containing the expected output (same file name as the test except with a different extension). If it...
Crate v1.0.120 2026-08-03
www.youtube.com
...crates it's useful like as evidenced by it's used all the cases that broke were match expression were match things whereas the inner use of interactions inside of a match block is that right looks like it looks like it yeah one of which is the dark comment...
Video 2021-05-11
docs.rs
...In those cases you should use a version of xmltree that matches the version of xml you are using: xml version xmltree version 1 0.12 0.8 0.11 0.7 0.8 0.6 0.6 Example See the documentation for some examples: https://docs.rs/xmltree/
Crate v0.12.0 2025-11-10
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
"Explicitness is the fourth core value of Rust. Ironically, I don’t see that “Explicitness” is ever explicitly stated as a goal of Rust."

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.