Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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.7 2026-11-24
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.7 2026-11-24
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.11.0 2026-09-26
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.2 2026-11-22
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
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
...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.4 2026-10-18
crates.io
cel
...request.time - resource.age < duration("24h") // Check whether all resource names in a list match a given filter. auth.claims.email_verified && resources.all(r, r.startsWith(auth.claims.email)) Getting Started Add cel to your Cargo.toml : cargo add cel Create and execute a simple CEL expression: use cel...
Crate v0.15.1 2026-11-24
docs.rs
...Principle of Operation In general chardetng prefers to do negative matching (rule out possibilities from the set of plausible encodings) than to do positive matching. Since negative matching is insufficient, there is positive matching, too. Except for ISO-2022-JP, pairs of ASCII bytes never contribute to the detection, which...
Crate v1.0.0 2026-03-30
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 v1.2.1 2026-11-17
docs.rs
Find peaks that match criteria in 1D data. Description Find a filtered subset of local maxima in 1D slice of data. The functionality implemented here is might be familiar to anyone using MATLAB's findpeaks , or Python's scipy.signal.find_peaks . Arguably, the most useful feature in this package...
Crate v0.1.5 2022-05-18
docs.rs
...Example use rustyline::error::ReadlineError; use rustyline::{DefaultEditor, Result}; fn main() -> Result<()> { // `()` can be used when no completer is required let mut rl = DefaultEditor::new()?; #[cfg(feature = "with-file-history")] if rl.load_history("history.txt").is_err() { println!("No previous history."); } loop { let readline = rl.readline(">> "); match readline { Ok...
Crate v19.0.0 2026-10-17
docs.rs
...use futures_util::StreamExt; use socketcan::{tokio::CanSocket, CanFrame, Result}; #[tokio::main] async fn main() -> Result<()> { let mut sock_rx = CanSocket::open("vcan0")?; let sock_tx = CanSocket::open("can0")?; while let Some(Ok(frame)) = sock_rx.next().await { if matches!(frame, CanFrame::Data(_)) { sock_tx.write_frame(frame).await?; } } Ok...
Crate v4.0.0 2026-09-05
docs.rs
...YAML that doesn’t match the expected Rust types is rejected early. Safer by construction: serde-saphyr avoids the typical YAML remote code execution vulnerability because it does not support or implement tag-driven object instantiation. Instead, it deserializes into fixed Rust types via Serde, removing the object-instantiation mechanism...
Crate v3.0.0-rc.1 2026-11-18
docs.rs
...SocketAddr = (ip, port).into(); let (name, service) = match getnameinfo(&socket, 0) { Ok((n, s)) => (n, s), Err(e) => panic!("Failed to lookup socket {:?}", e), }; println!("{:?} {:?}", name, service); let _ = (name, service); } { use dns_lookup::gethostname; let hostname = gethostname().unwrap(); }
Crate v4.0.2 2026-10-01
docs.rs
...bool, } fn parse_args() -> Result<Args, lexopt::Error> { use lexopt::prelude::*; let mut thing = None; let mut number = 1; let mut shout = false; let mut parser = lexopt::Parser::from_env(); while let Some(arg) = parser.next()? { match arg { Short('n') | Long("number") => { number = parser.value()?.parse()?; } Long("shout") => { shout = true...
Crate v0.3.2 2026-02-28
docs.rs
...42, }; match syslog::unix(formatter) { Err(e) => println!("impossible to connect to syslog: {:?}", e), Ok(mut writer) => { writer.err("hello world").expect("could not write error message"); } } } The struct syslog::Logger implements Log from the log crate, so it can be used as backend for other logging systems: extern crate...
Crate v7.0.0 2024-07-26
docs.rs
...Cohen-Sutherland TODO Cyrus-Beck Liang-Barsky Nicholl-Lee-Nicholl More comprehensive testing Installation cargo add line-clipping Minimum supported Rust version The crate is built with Rust 1.85 to match the 2024 edition. The MSRV may increase in a future minor release, but will be noted in the...
Crate v0.3.8 2026-08-03
crates.io
...use btoi::btoi; assert_eq!(Ok(42), btoi(b"42")); assert_eq!(Ok(-1000), btoi(b"-1000")); Documentation Read the documentation MSRV policy The minimum supported Rust version is 1.60, matching num_traits , with no intent to ever increase it. That's because #![feature(int_from_ascii)] in the...
Crate v0.5.0 2025-05-29
"Indeed. I notice even when after some Rust I return to the “main day job” C, I start to think differently, and it is excellent. Rust is like a com..."

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.