Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
...msg; msg = receiver.recv().unwrap(); println!("message {msg} received"); msg = receiver.recv().unwrap(); println!("message {msg} received"); // Third message may have never been sent match receiver.try_recv() { Ok(msg) => println!("message {msg} received"), Err(_) => println!("the third message was never sent"), } // Wait for threads to complete handle1.join().unwrap...
method std Stable since 1.0.0 Version 1.100.0-nightly
blog.merigoux.fr
...If the output of one test case matches, we can be a little bit more confident that our program is correct. But how can we be sure it will work in all situations? What if our test cases missed a corner case in our algorithm? One way to increase confidence...
News & Blog Posts 2019-04-16 ~9 min read
siciarz.net
...uint, primes: &Primes) -> Option<uint> { use std::iter::MultiplicativeIterator; match primes.factor(n) { Ok(factors) => Some(factors.into_iter().map(|(_, x)| x + 1).product()), Err(_) => None, } } The trick is to multiply all prime factor exponents, incremented before multiplication. See the explanation at Maths Challenge for the curious. So when we...
Blog Posts 2014-12-08 ~3 min read
docs.rs
...use futures_util::StreamExt; use socketcan::{tokio::CanSocket, CanFrame, Result}; #[tokio::main] async fn main() -> Result<()> { let mut sock_rx = CanSocket::open("vcan0")?; let sock_tx = CanSocket::open("can0")?; while let Some(Ok(frame)) = sock_rx.next().await { if matches!(frame, CanFrame::Data(_)) { sock_tx.write_frame(frame).await?; } } Ok...
Crate v4.0.0 2026-09-05
www.shuttle.rs
...The match keyword allows us to match the current event against a set of patterns. If the pattern matches, we execute the code in the corresponding branch. If the Result is Ok, we match against the XmlEvent::StartElement variant. This variant indicates that we are inside an opening tag. In...
Observations/Thoughts 2023-06-21 ~9 min read
docs.rs
...YAML that doesn’t match the expected Rust types is rejected early. Safer by construction: serde-saphyr avoids the typical YAML remote code execution vulnerability because it does not support or implement tag-driven object instantiation. Instead, it deserializes into fixed Rust types via Serde, removing the object-instantiation mechanism...
Crate v3.0.0-rc.1 2026-11-18
docs.rs
...SocketAddr = (ip, port).into(); let (name, service) = match getnameinfo(&socket, 0) { Ok((n, s)) => (n, s), Err(e) => panic!("Failed to lookup socket {:?}", e), }; println!("{:?} {:?}", name, service); let _ = (name, service); } { use dns_lookup::gethostname; let hostname = gethostname().unwrap(); }
Crate v4.0.2 2026-10-01
docs.rs
...bool, } fn parse_args() -> Result<Args, lexopt::Error> { use lexopt::prelude::*; let mut thing = None; let mut number = 1; let mut shout = false; let mut parser = lexopt::Parser::from_env(); while let Some(arg) = parser.next()? { match arg { Short('n') | Long("number") => { number = parser.value()?.parse()?; } Long("shout") => { shout = true...
Crate v0.3.2 2026-02-28
mender.io
...Through utilizing the pattern matching capabilities of Rust, the initial state-machine skeleton looks like: loop { let (state, action) = match (cur_state, cur_action) { (ExternalState::Init, Event::Uninitialized) => { match InitState::is_committed() { true => (ExternalState::Idle, Event::None), false => (ExternalState::Idle, Event::None), } } (ExternalState::Idle, _) if !client.is_authorized => { debug!("Client...
Learn More Rust 2020-08-18 ~11 min read
docs.rs
...42, }; match syslog::unix(formatter) { Err(e) => println!("impossible to connect to syslog: {:?}", e), Ok(mut writer) => { writer.err("hello world").expect("could not write error message"); } } } The struct syslog::Logger implements Log from the log crate, so it can be used as backend for other logging systems: extern crate...
Crate v7.0.0 2024-07-26
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour. Note that this is not the same as a rotate...
method core Stable since 1.2.0 Version 1.100.0-nightly
"I used to think of programs as execution flowing and think about what the CPU is doing. As I moved to rust I started thinking a lot more about memory:..."

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.