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
doc.rust-lang.org
pub mod result
...A simple function returning Result might be defined and used like so: #[derive(Debug)] enum Version { Version1, Version2 } fn parse_version(header: &[u8]) -> Result<Version, &'static str> { match header.get(0) { None => Err("invalid header length"), Some(&1) => Ok(Version::Version1), Some(&2) => Ok(Version::Version2), Some(_) => Err("invalid version...
module core Stable since 1.0.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
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 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
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
doc.rust-lang.org
pub const fn cold_path()
...i32) -> i32 { match x { 1 => 10, 2 => 100, 3 => { cold_path(); 1000 }, // this branch is unlikely _ => { cold_path(); 10000 }, // this is also unlikely } } This can also be used to implement likely and unlikely helpers to hint the condition rather than the branch: use core::hint::cold_path; #[inline(always)] pub...
function core Stable since 1.95.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
...The supplied key may be any borrowed form of the map's key type, but Hash and Eq on the borrowed form must match those for the key type. Examples use std::collections::HashMap; use std::hash::{Hash, Hasher}; #[derive(Clone, Copy, Debug)] struct S { id: u32, name: &'static str...
method std Stable since 1.40.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn home_dir() -> Option<crate::path::PathBuf>
...Examples use std::env; match env::home_dir() { Some(path) => println!("Your home directory, probably: {}", path.display()), None => println!("Impossible to get your home dir!"), }
function std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
...The supplied key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type. Examples use std::cmp::Ordering; use std::collections::BTreeMap; #[derive(Clone, Copy, Debug)] struct S { id: u32, name: &'static str, // ignored...
method alloc Stable since 1.40.0 Version 1.100.0-nightly
"they should just rename `unsafe` to `C` so people can shut up"

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.