Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust-lang-nursery.github.io
...The wav feature compiles in only the WAV reader; enable the features matching the formats you need. Play an audio file [![rodio-badge]][rodio] [![cat-multimedia-badge]][cat-multimedia] Playing a notification sound means opening an output device and handing it a decoded source. [rodio][rodio] does both. DeviceSinkBuilder::open...
The Rust Cookbook Book 2024-01-01 ~1 min read
crates.io
...let os = os_type::current_platform(); println!("Type: {:?}", os.os_type); println!("Version: {}", os.version); Or to provide different handling on different operating systems: match os_type::current_platform().os_type { os_type::OSType::OSX => { println!("This is probably an apple laptop!"); } os_type::OSType::Ubuntu => { println!("This is running...
Crate v2.6.0 2022-09-29
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.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
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.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
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
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
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.125 2026-11-16
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
crates.io
...These terms match the formula given on Wikipedia. avgdl ('average document length') is the aforementioned average meaningful token count; you should always provide a value for this and the crate can fit this for you. b controls document length normalization; 0 means no normalisation (length will not affect score) while...
Crate v2.3.2 2025-09-07
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
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
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
"why doesn't 'static, the largest lifetime, not simply eat all the others @mountain_ghosts 'static is biggest but actually,, weakest of lifetimes, becu..."

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.