Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
dev.to
...The parser splits up spaces per word, and provides them in order within the Vec. (Matched quotes are interpreted as a single word in our situation). main() fn main() -> Result<(), Box<dyn std::error::Error>> { let args = ApplicationArguments::from_args(); match args.subcommand { SubCommand::StartServer(opts) => { println!("Start the server...
Learn More Rust 2020-08-26 ~11 min read
sunshowers.io
...break; } } }, recv(signal_receiver) -> internal_event => { match internal_event { // internal_event is a Result<SignalEvent, RecvError>. Ok(event) => InternalEvent::Signal(event), Err(_) => { // Ignore the signal thread being dropped. This is done for // noop signal handlers. continue; } } }, }; // ... process internal_event } If this loop received a test event, it would bubble that...
Observations/Thoughts 2022-10-05 ~19 min read
doc.rust-lang.org
...Because there may not be any matching element, select_first returns an Option<ElementRef>. Finally, we use the Option::map method, which lets us work with the item in the Option if it’s present, and do nothing if it isn’t. (We could also use a match expression here...
The Rust Programming Language Book 2024-02-01 ~14 min read
blog.codecentric.de
...While this does not completely match up with all the capabilities of the “init-check-update for loop”, it does very elegantly cover the most common use. More complex cases will need to be written out using while. Match 1fn match_it(x: Option<i32>, flag: bool) -> i32 { 2 match...
Learn Standard Rust 2020-09-16 ~37 min read
docs.rs
...Cohen-Sutherland TODO Cyrus-Beck Liang-Barsky Nicholl-Lee-Nicholl More comprehensive testing Installation cargo add line-clipping Minimum supported Rust version The crate is built with Rust 1.85 to match the 2024 edition. The MSRV may increase in a future minor release, but will be noted in the...
Crate v0.3.8 2026-08-03
doc.rust-lang.org
pub fn open<P>(&self, path: P) -> io::Result<File>
...The following errors don't match any existing io::ErrorKind at the moment: • One of the directory components of the specified file path was not, in fact, a directory. • Filesystem-level errors: full disk, write permission requested on a read-only file system, exceeded disk quota, too many open files...
method std Stable since 1.0.0 Version 1.100.0-nightly
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 v3.6.2 2026-06-19
coaxion.net
...gio::File) -> Result<(), String> { // Try to open the file let (_file, strm) = await!(file.read_async_future(glib::PRIORITY_DEFAULT)) .map_err(|(_file, err)| format!("Failed to open file: {}", err))?; Ok(())}fn main() { [...] let future = async_block! { match await!(read_file(file)) { Ok(()) => (), Err(err) => eprintln!("Got error: {}", err), } l...
News & Blog Posts 2018-04-24 ~13 min read
www.youtube.com
...it it just seemed so annoying that i also probably depends where you're what you're matching against if it's something like a string and you're trying to match a string literal you're never getting exhausted this anyway i mean if let also like you know...
Video 2021-02-10
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
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
crates.io
...use btoi::btoi; assert_eq!(Ok(42), btoi(b"42")); assert_eq!(Ok(-1000), btoi(b"-1000")); Documentation Read the documentation MSRV policy The minimum supported Rust version is 1.60, matching num_traits , with no intent to ever increase it. That's because #![feature(int_from_ascii)] in the...
Crate v0.5.0 2025-05-29
docs.rs
...Only emits a single Rename event if the rename From and To events can be matched Merges multiple Rename events Takes Rename events into account and updates paths for events that occurred before the rename event, but which haven't been emitted, yet Optionally keeps track of the file system...
Crate v0.8.0-rc.2 2026-05-02
doc.rust-lang.org
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize>
...Examples use std::net::UdpSocket; let socket = UdpSocket::bind("127.0.0.1:34254").expect("bind should succeed"); socket.connect("127.0.0.1:8080").expect("connect should succeed"); let mut buf = [0; 10]; match socket.peek(&mut buf) { Ok(received) => println!("received {received} bytes"), Err(e) => println!("peek function...
method std Stable since 1.18.0 Version 1.100.0-nightly
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
github.com
...Gc<Monster>, room: &mut Room) { match room.find_random_exit() { None => { } Some(exit) => { victim.move_to_room(exit); } } } As before, we'll start out with a type of `Monster`, but this type the method `move_to_room()` has a receiver type of `Gc<Monster>`. This doesn't match cases 1...
RFC 48 RFC 2014-06-10 ~23 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 v1.1.0 2026-08-15
rust-lang-nursery.github.io
...guess_format reads the leading magic bytes and returns the matching ImageFormat, which in turn gives the MIME type through ImageFormat::to_mime_type. Only the header is examined, so a short prefix of the file is enough. Inspect image EXIF metadata [![kamadak-exif-badge]][kamadak-exif] [![cat-multimedia-badge...
The Rust Cookbook Book 2024-01-01 ~1 min read
"So long, and thanks for all the turbofish."

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.