Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
crates.io
...Installation Select a version of kube along matching versions of k8s-openapi and schemars for Kubernetes structs and matching schemas. See also historical Kubernetes versions . [dependencies] kube = { version = "4.2.0", features = ["runtime", "derive"] } k8s-openapi = { version = "0.28.0", features = ["latest", "schemars"] } schemars = { version = "1" } See features for a...
Crate v4.2.0 2026-07-22
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
antoinerr.github.io
...match failing_function() { Ok(s) => println!("{s}"), Err(e) => match e.downcast_ref() { Some(MyErrors::LetsFixThisTomorrowError) => (), Some(MyErrors::ThisDoesntLookGoodError) => (), Some(MyErrors::ImmaGetFiredError) => (), None => (), }, } Returning early with an error Finally, anyhow provides a utility macro to return early from your methods with an error: the bail! macro. Here is how it...
Rust Walkthroughs 2023-02-01 ~6 min read
doc.rust-lang.org
...In that regard, macro_rules! can work similarly to a match block: // `test!` will compare `$left` and `$right` // in different ways depending on how you invoke it: macro_rules! test { // Arguments don't need to be separated by a comma. // Any template can be used! ($left:expr; and $right:expr...
Rust by Example Book 2024-01-01 ~1 min read
github.com
...use system_shutdown::shutdown; fn main() { match shutdown() { Ok(_) => println!("Shutting down, bye!"), Err(error) => eprintln!("Failed to shut down: {}", error), } } In most of the systems it does not requires the user to be root/admin. Contributions Pull Requests are welcome! =) License system_shutdown is licensed under either of the...
Crate v4.1.0 2026-01-17
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
speakerdeck.com
Transcript ALGEBRAIC DATA TYPES enum Color { Red, Green, Blue } enum Tree { Empty, Leaf(int), Node(~Tree, ~Tree) } tag tag int tag ~Tree ~Tree Empty Leaf(int) Node(~Tree, ~Tree) PATTERN MATCHING enum Option<T> { None, Some(T) } fn double(p: ~int) -> int { *p * 2 } OWNERSHIP void *realloc(void *, ...); void free...
Discussion + Blog posts 2013-07-29 ~1 min read
ryan-jacobs1.github.io
...fn cleanup() { let me = smp::me(); let mut cleanup_work = CLEANUP[me].lock(); loop { match cleanup_work.get_task() { Some(work) => {work()}, None => {break} } } } Now we can finish our implementation of surrender and move on to block: pub fn surrender() { let mut current_thread: Box<dyn TCB> = match swap_active...
News & Blog Posts 2020-01-14 ~9 min read
arzg.github.io
...Option<ast::Expr>) -> Expr { if let Some(ast) = ast { match ast { // snip ast::Expr::VariableRef(ast) => Expr::VariableRef { var: ast.name().unwrap().text().into(), }, } } else { // snip } } // snip } That match arm is longer than one line; let’s extract it to a method for consistency:impl Database { // snip pub(crate) fn...
Rust Walkthroughs 2021-01-27 ~18 min read
blog.turbo.fish
...Figuring out what's inside is a simple manner of matching: use syn::{Data, DataStruct, Fields}; let fields = match input.data { Data::Struct(DataStruct { fields: Fields::Named(fields), .. }) => fields.named, _ => panic!("this derive macro only works on structs with named fields"), }; Here, we panic!() if the input is not what...
Rust Walkthroughs 2021-02-24 ~12 min read
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
www.youtube.com
...be totally valid to have like some other kind of decal to have two non-terminals that both match to the same set of things and when you do the pattern matching you couldn't really tell the difference between whether something was originally a trait impuldecal and you just...
Video 2022-04-20
brson.github.io
...Linked error-chain errors are able to propagate backtraces and have a structural shape that is easy to deeply match, so that e.g. your error that originated in your utils crate, bubbled through your net crate, then up through your app crate is easy to pinpoint through pattern matching...
News & Blog Posts 2016-12-06 ~6 min read
nikolish.in
...Self::Message) { match message { CounterMessage::Increment => self.count += 1, CounterMessage::Decrement => self.count -= 1, CounterMessage::ChangePage(view) => self.current_view = view }} We simple update the state of our application by assigning the current_view with the view that is passed by the message. We now need to somehow produce this...
Observations/Thoughts 2022-06-22 ~7 min read
rust-analyzer.github.io
...emit fewer download progress notifications. #7419, #7422 unquote strings when expanding concat!. #7438 shorten hir::TypeParam ranges for traits in NavigationTarget. #7406 don’t assume happy path in if_let_match. #7464 export CARGO for proc. macros. #7465 only hide parameter hints for path, field and methodcall expressions. #7487 forbid...
Project/Tooling Updates 2021-02-03 ~1 min read
rust-analyzer.github.io
#13805 (first contribution) complete enum variants without parens when snippets are disabled. #13794 fix "parser seems stuck" panics when parsing colossal files. #13795 use the correct edition when formatting code in path dependencies. #13800 don’t match let expressions and inline consts in expr MBE fragments. #13820 fix binding mode...
Project/Tooling Updates 2022-12-28 ~1 min read
rust-analyzer.github.io
...boxed slices (~2 MB win on analysis-stats self). #14151 enable smallvec's union feature (~4 MB win on analysis-stats self). #14156 don’t reconstruct ref match completion in to_proto manually. #14165 make CompletionItem more POD-like. #14147 don’t rely on VSCode internal commands in the server.
Project/Tooling Updates 2023-02-22 ~1 min read
"Rust favours security over convenience. Rust does not want you to make silly little mistakes than can waste so much of your time debugging, which in t..."

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.