Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
fn cmp(&self, other: &Self) -> Ordering
...By convention, self.cmp(&other) returns the ordering matching the expression self <operator> other if true. Examples use std::cmp::Ordering; assert_eq!(5.cmp(&10), Ordering::Less); assert_eq!(10.cmp(&5), Ordering::Greater); assert_eq!(5.cmp(&5), Ordering::Equal);
method core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub trait Not
...use std::ops::Not; #[derive(Debug, PartialEq)] enum Answer { Yes, No, } impl Not for Answer { type Output = Self; fn not(self) -> Self::Output { match self { Answer::Yes => Answer::No, Answer::No => Answer::Yes } } } assert_eq!(!Answer::Yes, Answer::No); assert_eq!(!Answer::No, Answer::Yes);
trait core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn connect_addr(&self, socket_addr: &SocketAddr) -> io::Result<()>
...Examples use std::os::unix::net::{UnixDatagram}; fn main() -> std::io::Result<()> { let bound = UnixDatagram::bind("/path/to/socket")?; let addr = bound.local_addr()?; let sock = UnixDatagram::unbound()?; match sock.connect_addr(&addr) { Ok(sock) => sock, Err(e) => { println!("Couldn't connect: {e:?}"); return Err(e) } }; Ok(()) }
method std Stable since 1.70.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains<Q>(&self, value: &Q) -> bool
...The value may be any borrowed form of the set's value type, but Hash and Eq on the borrowed form must match those for the value type. Examples use std::collections::HashSet; let set = HashSet::from([1, 2, 3]); assert_eq!(set.contains(&1), true); assert_eq!(set.contains...
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn connect_addr(socket_addr: &SocketAddr) -> io::Result<UnixStream>
...Examples use std::os::unix::net::{UnixListener, UnixStream}; fn main() -> std::io::Result<()> { let listener = UnixListener::bind("/path/to/the/socket")?; let addr = listener.local_addr()?; let sock = match UnixStream::connect_addr(&addr) { Ok(sock) => sock, Err(e) => { println!("Couldn't connect: {e:?}"); return Err(e) } }; Ok(()) }
associated_function std Stable since 1.70.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn bind_addr(socket_addr: &SocketAddr) -> io::Result<UnixDatagram>
...Examples use std::os::unix::net::{UnixDatagram}; fn main() -> std::io::Result<()> { let sock1 = UnixDatagram::bind("path/to/socket")?; let addr = sock1.local_addr()?; let sock2 = match UnixDatagram::bind_addr(&addr) { Ok(sock) => sock, Err(err) => { println!("Couldn't bind: {err:?}"); return Err(err); } }; Ok(()) }
associated_function std Stable since 1.70.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn ends_with<P>(&self, child: P) -> bool
...Only considers whole path components to match. Examples use std::path::Path; let path = Path::new("/etc/resolv.conf"); assert!(path.ends_with("resolv.conf")); assert!(path.ends_with("etc/resolv.conf")); assert!(path.ends_with("/etc/resolv.conf")); assert!(!path.ends_with("/resolv.conf")); assert!(!path.ends_with("conf...
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn back_mut(&mut self) -> Option<&mut T>
...Examples use std::collections::VecDeque; let mut d = VecDeque::new(); assert_eq!(d.back(), None); d.push_back(1); d.push_back(2); match d.back_mut() { Some(x) => *x = 9, None => (), } assert_eq!(d.back(), Some(&9));
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn iter_mut(&mut self) -> IterMut<'_, T>
...Result<u32, &str> = Ok(7); match x.iter_mut().next() { Some(v) => *v = 40, None => {}, } assert_eq!(x, Ok(40)); let mut x: Result<u32, &str> = Err("nothing!"); assert_eq!(x.iter_mut().next(), None);
method core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct Incoming<'a>
...UnixStream) { // ... } fn main() -> std::io::Result<()> { let listener = UnixListener::bind("/path/to/the/socket")?; for stream in listener.incoming() { match stream { Ok(stream) => { thread::spawn(|| handle_client(stream)); } Err(err) => { break; } } } Ok(()) }
struct std Stable since 1.10.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn bind_addr(socket_addr: &SocketAddr) -> io::Result<UnixListener>
...Examples use std::os::unix::net::{UnixListener}; fn main() -> std::io::Result<()> { let listener1 = UnixListener::bind("path/to/socket")?; let addr = listener1.local_addr()?; let listener2 = match UnixListener::bind_addr(&addr) { Ok(sock) => sock, Err(err) => { println!("Couldn't bind: {err:?}"); return Err(err); } }; Ok(()) }
associated_function std Stable since 1.70.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn front_mut(&mut self) -> Option<&mut T>
...Examples use std::collections::VecDeque; let mut d = VecDeque::new(); assert_eq!(d.front_mut(), None); d.push_back(1); d.push_back(2); match d.front_mut() { Some(x) => *x = 9, None => (), } assert_eq!(d.front(), Some(&9));
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn incoming(&self) -> Incoming<'_>
...UnixStream) { // ... } fn main() -> std::io::Result<()> { let listener = UnixListener::bind("/path/to/the/socket")?; for stream in listener.incoming() { match stream { Ok(stream) => { thread::spawn(|| handle_client(stream)); } Err(err) => { break; } } } Ok(()) }
method std Stable since 1.10.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn _mm_setr_ps(a: f32, b: f32, c: f32, d: f32) -> __m128
...This matches the memory order of __m128, i.e., a will be the lowest 32 bits of the result, and d the highest. assert_eq!(__m128::new(a, b, c, d), _mm_setr_ps(a, b, c, d)); Intel's documentation
function core Stable since 1.27.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get<Q>(&self, key: &Q) -> Option<&V>
...The 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::collections::BTreeMap; let mut map = BTreeMap::new(); map.insert(1, "a"); assert_eq!(map.get(&1), Some(&"a")); assert...
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains<Q>(&self, value: &Q) -> bool
...The value may be any borrowed form of the set's element type, but the ordering on the borrowed form must match the ordering on the element type. Examples use std::collections::BTreeSet; let set = BTreeSet::from([1, 2, 3]); assert_eq!(set.contains(&1), true); assert_eq!(set.contains...
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn get<Q>(&self, k: &Q) -> Option<&V>
...The 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; let mut map = HashMap::new(); map.insert(1, "a"); assert_eq!(map.get(&1), Some(&"a")); assert...
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn connect<P>(&self, path: P) -> io::Result<()>
...Examples use std::os::unix::net::UnixDatagram; fn main() -> std::io::Result<()> { let sock = UnixDatagram::unbound()?; match sock.connect("/path/to/the/socket") { Ok(sock) => sock, Err(e) => { println!("Couldn't connect: {e:?}"); return Err(e) } }; Ok(()) }
method std Stable since 1.10.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn back_mut(&mut self) -> Option<&mut T>
...Examples use std::collections::LinkedList; let mut dl = LinkedList::new(); assert_eq!(dl.back(), None); dl.push_back(1); assert_eq!(dl.back(), Some(&1)); match dl.back_mut() { None => {}, Some(x) => *x = 5, } assert_eq!(dl.back(), Some(&5));
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn front_mut(&mut self) -> Option<&mut T>
...Examples use std::collections::LinkedList; let mut dl = LinkedList::new(); assert_eq!(dl.front(), None); dl.push_front(1); assert_eq!(dl.front(), Some(&1)); match dl.front_mut() { None => {}, Some(x) => *x = 5, } assert_eq!(dl.front(), Some(&5));
method alloc Stable since 1.0.0 Version 1.100.0-nightly
"last time i talked to the infra team they made a bot to replace kennytm. i fear if I ask them to write a rust based unikernel with a custom os to host..."

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.