Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
...Result<i32>) { match result { Ok(n) => println!("The first doubled is {}", n), Err(e) => println!("Error: {}", e), } } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let strings = vec!["tofu", "93", "18"]; print(double_first(numbers)); print(double_first(empty)); print(double_first(strings)); } See also: Dynamic dispatch...
Rust by Example Book 2024-01-01 ~1 min read
aminediro.com
...u8, buf: &mut Vec<u8>) -> Result<usize> { loop { let (done, used) = { let available = match r.fill_buf() { // ... }; match memchr::memchr(delim, available) { Some(i) => { buf.extend_from_slice(&available[..=i]); (true, i + 1) } None => { buf.extend_from_slice(available); (false, available.len()) } } }; r.consume(used); read += used; if done || used...
Rust Walkthroughs 2024-01-24 ~22 min read
blogs.kde.org
...The mapping of completion match metadata to Kate's format (from fundamentals like the match type, to more complex features like smart grouping) can likely be improved still. Ditto for auto-completion behavior (i.e. defining the circumstances in which the completion popup will kick in automatically, as opposed to...
Project Updates 2015-05-18 ~3 min read
blog.aloni.org
...Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> { match self.fib.state { State::Halted => { self.fib.state = State::Running; Poll::Ready(()) } State::Running => { self.fib.state = State::Halted; Poll::Pending } } } } Executor Our executor keeps a vector of uncompleted futures, where the state of each future is located on the...
News & Blog Posts 2020-01-28 ~3 min read
dev.to
...EnumValue<PhoneType>, // ... } // Match directly - the type carries the known/unknown distinction: match contact.phone_type { EnumValue::Known(PhoneType::MOBILE) => { /* ... */ } EnumValue::Known(PhoneType::HOME) => { /* ... */ } EnumValue::Known(PhoneType::WORK) => { /* ... */ } EnumValue::Unknown(v) => { /* v is the raw i32 from the wire */ } } // Or compare directly (PartialEq<E> is implemented): if contact.phone_type == PhoneType...
Project/Tooling Updates 2026-03-25 ~13 min read
gfx-rs.github.io
...team ported WebRender over and got Firefox and Servo running on gfx-hal Our API has settled to be at the lowest level, practically matching Vulkan semantics now, and became completely unsafe. To compensate for this, we have started WebGPU implementation with the idea of it becoming the lowest safe...
News & Blog Posts 2019-01-01 ~1 min read
crates.io
...use srcsrv::{SrcSrvStream, SourceRetrievalMethod}; if let Ok(srcsrv_stream) = pdb.named_stream(b"srcsrv") { let stream = SrcSrvStream::parse(srcsrv_stream.as_slice())?; let url = match stream.source_for_path( r#"C:\build\renderdoc\renderdoc\data\glsl\gl_texsample.h"#, r#"C:\Debugger\Cached Sources"#, )? { SourceRetrievalMethod::Download { url } => Some(url), _ => None...
Crate v0.2.3 2025-03-07
doc.rust-lang.org
pub fn recv(&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.recv(&mut buf) { Ok(received) => println!("received {received} bytes {:?}", &buf[..received]), Err(e) => println...
method std Stable since 1.9.0 Version 1.100.0-nightly
docs.rs
...While checks are all tested // and must all succeed, allow/deny policies are tried one by one in order, // and we stop verification on the first that matches // // here we will check that the token has the corresponding right allow if right("/a/file1.txt", "read"); // explicit catch-all deny...
Crate v7.0.0-alpha.4 2026-11-17
fitzgeraldnick.com
...querying each field of a struct, matching on a variant and querying each of the matched variant’s children. It is also mechanically implemented inside #[derive(Term)]. The final querying puzzle piece is a combinator putting the one-layer querying traversal together with generic query functions into recursive querying traversal...
News & Blog Posts 2017-08-08 ~15 min read
fasterthanli.me
...non-exhaustive patterns: `5u16..=std::u16::MAX` not covered --> src/lib.rs:17:15 | 17 | match x { | ^ pattern `5u16..=std::u16::MAX` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms To deal with that possibility, we could return an...
News & Blog Posts 2020-02-25 ~29 min read
pyo3.rs
...Py_ssize_t, ) -> *mut PyObject { if nargs != 2 { PyErr_SetString( PyExc_TypeError, c"sum_as_string expected 2 positional arguments".as_ptr(), ); return std::ptr::null_mut(); } let (first, second) = (*args, *args.add(1)); let first = match parse_arg_as_i32(first, 1) { Some(x) => x, None => return std::ptr...
Crate v0.30.1 2026-10-14
docs.rs
...Features Generates efficient data parsers and serialisers for structs and enums using #[derive] Reads and writes data from any source using standard io::Read and io::Write streams Directives in attributes handle common binary parsing tasks like matching magic numbers, byte ordering, padding & alignment, data validation, and more Includes reusable...
Crate v0.15.2 2026-07-23
www.simonclark.dev
...Vec<u32>, } pub fn solve_sudoku(input: &mut Sudoku) -> bool { match find_first_empty(&input.board) { None => true, Some((row, col)) => { for option in options_for(&input.board, row, col){ let idx = (row * 9 + col) as usize; input.board[idx] = option; if solve_sudoku(input) { return true; } input.board[idx...
Observations/Thoughts 2021-04-21 ~5 min read
llogiq.github.io
...bad_bit_mask, cmp_nan, eq_op, empty_loop, match_overlapping_arm, ineffective_bit_mask, min_max, modulo_one, nonsensical_open_options, out_of_bounds_indexing, range_step_by_zero, unit_cmp and others Readability – a good many lints suggest readability improvements, such as approx_constant, block_in_if_condition...
Notable New Crates & Project Updates 2016-02-01 ~3 min read
steveklabnik.com
...the profit from the book won’t go to me, it will go to OpenHatch, “a non-profit dedicated to matching prospective free software contributors with communities, tools, and education,” to use their words about it. I’ll let you know when we’re closer to actually shipping!
News & Blog Posts 2015-09-14 ~1 min read
blog.lilyf.org
...swapped_context }; let cloned = py_context.clone(); let content = self.func.call1( py, (cloned,)?; let inner_context = match Arc::try_unwrap( py_context.context) { Ok(inner_context) => { inner_context } Err(_) => todo!(), }; let _ = std::mem::replace( context, inner_context); Ok(content.to_string()) } } } This works great when Python doesn’t keep...
Rust Walkthroughs 2025-09-03 ~5 min read
docs.rs
xcb
...Therefore, all events can be handled in a single match expression. Many functions (such as wait_for_event ) return a xcb::Result which allows idiomatic error handling. fn main() -> xcb::Result<()> { // ... loop { match conn.wait_for_event()? { xcb::Event::X(x::Event::KeyPress(key_press)) => { // do stuff } xcb::Event::Xkb...
Crate v1.7.1 2026-08-09
blog.japaric.io
...a task token whose type must match the interrupt field of the declaration, a priority token whose type must match the priority field of the declaration, and a threshold token whose type must match the level of the priority token. The priority and threshold tokens we have already seen. The...
News & Blog Posts 2017-05-09 ~37 min read
219design.com
...Example match block!(bnrg.with_spi(&mut spi, |c| c.read())) { Ok(p) => { let hci::host::uart::Packet::Event(e) = p; match e { bluetooth_hci::event::Event::ConnectionComplete(params) => { // handle the new connection } bluetooth_hci::event::Event::Vendor( bluenrg::event::BlueNRGEvent::HalInitialized(reason), ) => { // handle the BlueNRG chip reset } _ => (), } } Err(e...
News & Blog Posts 2018-10-09 ~12 min read
"This is a wonderful unsoundness and I am incredibly excited about it :3"

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.