Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
github.com
...assert_eq!(Adler32::from_buf(&decompressed).finish(), checksum.unwrap()); // Verify that the decompressed data matches the original. assert_eq!(data, &decompressed[..]); For detail on more advanced usage, see the full API documentation . License Licensed under either of Apache License, Version 2.0 ( LICENSE-APACHE or http://www.apache.org/licenses...
Crate v0.2.1 2025-01-03
dcuddeback.github.io
...extern crate libudev; fn main() { let context = libudev::Context::new().unwrap(); let mut enumerator = libudev::Enumerator::new(&context).unwrap(); enumerator.match_subsystem("tty").unwrap(); for device in enumerator.scan_devices().unwrap() { println!("found device: {:?}", device.syspath()); } } License Copyright © 2015 David Cuddeback Distributed under the MIT License .
Crate v0.3.0 2021-01-17
crates.io
...fn eval(e: &Expr) -> i64 { e.collapse_frames(|frame| match frame { ExprFrame::Add(a, b) => a + b, ExprFrame::Sub(a, b) => a - b, ExprFrame::Mul(a, b) => a * b, ExprFrame::LiteralInt(x) => x, }) } let expr = multiply(subtract(literal(1), literal(2)), literal(3)); assert_eq!(eval(&expr), -3); Here's...
Crate v0.5.4 2025-06-09
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
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
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 v6.0.0 2025-07-16
crates.io
...writer.push(i).is_some() { // The ringbuffer is full, yield the thread std::thread::yield_now(); } }); // Loop that pulls elements from the ringbuffer loop { match reader.pull() { // We have got an element, do something Some(t) => std::hint::blackbox(t), // The ringbuffer is empty, yield the thread None => std::thread...
Crate v0.2.2 2026-01-27
github.com
...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.29.2 2026-08-05
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
docs.rs
...proc_macro::TokenStream) -> proc_macro::TokenStream { match my_macro(tokens.into()) { Ok(tokens) => tokens.into(), Err(diag) => diag.emit_as_expr_tokens().into() } } This does the right thing on nightly or stable. Caveats On stable, due to limitations, any top-level, non-error diagnostics are emitted as errors. This will...
Crate v0.10.1 2023-07-10
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.0 2026-08-13
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.0 2026-08-13
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.0 2026-08-13
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.0 2026-08-13
crates.io
...Serialize/Deserialize a map while preserving order The aim is to match the standard library HashMap/Set with additional LinkedList style methods and ordered-iterators. Changelog Features serde - Enable serde Serialization and Deserialization Usage use ordered_hash_map::OrderedHashMap; fn main() { let mut map = OrderedHashMap::new(); map.insert("apple", 5...
Crate v0.6.0 2026-05-05
crates.io
...Print image dimensions use jfifdump::{Reader, SegmentKind, JfifError}; use std::fs::File; use std::io::BufReader; fn main() -> Result<(), JfifError> { let file = File::open("some.jpeg")?; let mut reader = Reader::new(BufReader::new(file))?; loop { match reader.next_segment()?.kind { SegmentKind::Eoi => break, SegmentKind::Frame(frame) => { println!("{}x{}", frame.dimension...
Crate v0.6.0 2024-10-05
docs.rs
...enum Fruit { Apple, Bramble(BrambleFruit), Pear, } trait NameOf { fn name_of(&self) -> &str; } impl NameOf for Fruit { fn name_of(&self) -> &str { match self { Fruit::Apple => "apple", Fruit::Bramble(fruit) => fruit.name_of(), Fruit::Pear => "pear", } } } enum BrambleFruit { Blackberry, } impl NameOf for BrambleFruit { fn name_of(&self) -> &str { match self...
Crate v2.1.0 2025-11-07
docs.rs
...foundationdb::Database::default()?; // write a value in a retryable closure match db .run(|trx, _maybe_committed| async move { trx.set(b"hello", b"world"); Ok(()) }) .await { Ok(_) => println!("transaction committed"), Err(_) => eprintln!("cannot commit transaction"), }; // read a value match db .run(|trx, _maybe_committed| async move { Ok(trx.get(b...
Crate v0.11.0 2026-06-24
salvo.rs
...Browsers send preflight OPTIONS requests before the real request, and those preflight requests may not match any router branch. use salvo::cors::Cors; use salvo::http::Method; use salvo::prelude::*; #[handler] async fn hello() -> &'static str { "Hello World" } #[tokio::main] async fn main() { let cors = Cors::new() .allow_origin("https...
Crate v0.95.2 2026-08-06
docs.rs
...Basic selector matching (including child and descendents, classes and element types). Attribute selectors including [foo] and [foo="bar"] nth-child pseudo-class. CSS colors ( color / background-color ) will add Coloured(...) / BgColoured(...) nodes to the render tree. Rules with display: none will cause matching elements to be removed from the render...
Crate v0.17.1 2026-04-19
"My Rust memoirs will be called "Once in 'a lifetime"."

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.