Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
crates.io
...pub enum DbDriver { Postgresql, Mysql, } impl std::str::FromStr for DbDriver { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { match s.trim().to_lowercase().as_ref() { "postgres" => Ok(DbDriver::Postgresql), "mysql" => Ok(DbDriver::Mysql), _ => Err(format!("Unknown DB driver: {s}")) } } } #[derive(Envconfig)] pub struct DbConfig { // ... #[envconfig...
Crate v0.11.1 2025-12-10
crates.io
...use docker_credential; use docker_credential::DockerCredential; let credential = docker_credential::get_credential("https://index.docker.io/v1/").expect("Unable to retrieve credential"); match credential { DockerCredential::IdentityToken(token) => println!("Identity token: {}", token), DockerCredential::UsernamePassword(user_name, password) => println!("Username: {}, Password: {}", user_name, password), };
Crate v1.4.0 2026-05-19
crates.io
...pub enum DbDriver { Postgresql, Mysql, } impl std::str::FromStr for DbDriver { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { match s.trim().to_lowercase().as_ref() { "postgres" => Ok(DbDriver::Postgresql), "mysql" => Ok(DbDriver::Mysql), _ => Err(format!("Unknown DB driver: {s}")) } } } #[derive(Envconfig)] pub struct DbConfig { // ... #[envconfig...
Crate v0.11.1 2025-12-10
docs.rs
...syn::DeriveInput) -> syn::Result<TokenStream> { let attrs = Attrs::parse_attrs("from", &input)?; match (attrs.forward.is_some(), !attrs.custom.is_empty()) { (true, true) => Err(syn::Error::new_spanned( input, "`forward` and `on` arguments are mutually exclusive", )), (false, false) => Err(syn::Error::new_spanned( input, "either `forward` or `on` argument is...
Crate v0.5.1 2026-07-22
docs.rs
...16) -> Result<Self, Self::Error> { match n { 0 => Ok(Foo::Bar), 100 => Ok(Foo::Baz), 200 => Ok(Foo::Quix), _ => Err(n), } } } fn main() { let bar = Foo::try_from(0); let baz = Foo::try_from(100); let quix = Foo::try_from(200); let bad = Foo::try_from(300); assert_eq!(bar...
Crate v1.0.0 2020-03-30
docs.rs
...use std::io::Read; use wl_clipboard_rs::{paste::{get_contents, ClipboardType, Error, MimeType, Seat}}; let result = get_contents(ClipboardType::Regular, Seat::Unspecified, MimeType::Text); match result { Ok((mut pipe, _)) => { let mut contents = vec![]; pipe.read_to_end(&mut contents)?; println!("Pasted: {}", String::from_utf8_lossy(&contents)); } Err(Error::NoSeats...
Crate v0.9.5 2026-10-26
crates.io
...This means that you cannot directly match on an IValue to determine its type. Instead, an IValue offers several ways to get at the inner type: Destructuring using IValue::destructure[{_ref,_mut}]() These methods return wrapper enums which you can directly match on, so these methods are the most direct...
Crate v0.1.7 2026-07-16
docs.rs
...std::fs::{symlink_file, symlink_dir} , matching symlink_auto or nothing. std::fs::{soft_link_file, soft_link_dir} , matching soft_link if it is undeprecated. But I don’t like the name “soft link,” anyway: no one calls them that, we all call them symlinks. Note that despite the...
Crate v0.1.0 2017-01-27
magiclen.org
...In this crate, crc32 matches crc32b from mhash , and crc32mhash matches crc32 from mhash . crc32bzip2 crc32c crc32d crc32mpeg2 crc32posix crc32q crc32jamcrc crc32xfer crc40gsm crc64 crc64iso crc64we crc64jones For example: use crc_any::CRC; let mut crc64 = CRC::crc64(); crc64.update(b"hello"); After you get a CRC value, you can...
Crate v3.1.0 2026-09-29
github.com
...The bindings are checked in CI to ensure that what exists in git matches the output of the script. License This project is licensed under either of Apache License, Version 2.0, ( LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 ) MIT license ( LICENSE-MIT or http://opensource...
Crate v0.1.13+1.68.1 2026-03-31
docs.rs
...extern crate unicode_normalization_alignments; use unicode_normalization_alignments::char::compose; use unicode_normalization_alignments::UnicodeNormalization; fn main() { assert_eq!(compose('A','\u{30a}'), Some('Å')); let s = "ÅΩ"; let c = s.nfc().map(|(c, diff)| { match diff { 0 => println!("Nothing changed here"), 1 => println!("New character"), _ => println!("{} characters were...
Crate v0.1.12 2019-12-30
crates.io
...Currently a lot of documentation is rather terse, referring to the matching methods on the string types in the standard library is best in those cases. Feel free to contribute more exhaustive in-line docs.
Crate v0.2.0 2020-10-10
docs.rs
...Example match rexif::parse_file(&file_name) { Ok(exif) => { println!("{} {} exif entries: {}", file_name, exif.mime, exif.entries.len()); for entry in &exif.entries { println!(" {}: {}", entry.tag, entry.value_more_readable); } }, Err(e) => { eprintln!("Error in {}: {} {}", &file_name, Error::description(&e), e.extra).unwrap(); } } The src/main.rs file is...
Crate v0.7.6 2026-10-13
docs.rs
...ChannelBuilderError> { Ok(Channel { id: match self.id { Some(ref value) => Clone::clone(value), None => { return Err( Into::into( ::derive_builder::UninitializedFieldError::from("id"), ), ) } }, token: match self.token { Some(ref value) => Clone::clone(value), None => { return Err( Into::into( ::derive_builder::UninitializedFieldError::from("token"), ), ) } }, special_info: match self.special_info { Some...
Crate v0.20.2 2024-10-08
docs.rs
xml
...use std::fs::File; use std::io::BufReader; use xml::reader::{EventReader, XmlEvent}; fn main() -> std::io::Result<()> { let file = File::open("file.xml")?; let file = BufReader::new(file); // Buffering is important for performance let parser = EventReader::new(file); let mut depth = 0; for e in parser { match e { Ok...
Crate v1.4.0 2026-08-06
malachite.rs
...The current floating-point string conversion functions are incomplete and will be changed in the future to match MPFR's behavior. Malachite is developed by Mikhail Hogrefe. Thanks to 43615, b4D8, Romain Billot, Maxim Biryukov, coolreader18, Dasaav-dsv, Duncan Freeman, florian1345, konstin, Rowan Hart, YunWon Jeong, Park Joon-Kyu, Antonio...
Crate v0.15.0 2026-11-23
crates.io
...fn main() { let client = client("localhost:18443", "user", "pass").expect("failed to create client"); let request = client.build_request("uptime", None); let response = client.send_request(request).expect("send_request failed"); // For other commands this would be a struct matching the returned json. let result: u64 = response.result().expect("response...
Crate v0.21.0 2026-09-28
docs.rs
...expect("failed to execute process"); } } Simple Fork Example use fork::{fork, Fork, waitpid, WIFEXITED, WEXITSTATUS}; match fork() { Ok(Fork::Parent(child)) => { println!("Parent process, child PID: {}", child); // Wait for child and check exit status match waitpid(child) { Ok(status) => { if WIFEXITED(status) { println!("Child exited with code: {}", WEXITSTATUS(status)); } } Err...
Crate v0.12.0 2026-11-16
crates.io
...new(("sample.tao", 11..48)) .with_message(format!( "The values are outputs of this {} expression", "match".fg(out), )) .with_color(out), ) .with_note(format!( "Outputs of {} expressions must coerce to the same type", "match".fg(out) )) .finish() .print(("sample.tao", Source::from(include_str!("sample.tao")))) .unwrap(); } See examples/ for...
Crate v0.6.0 2025-10-28
github.com
...use parity_tokio_ipc::Endpoint; use futures::stream::StreamExt; // For testing purposes only - instead, use a path to an actual socket or a pipe let addr = parity_tokio_ipc::dummy_endpoint(); let server = async move { Endpoint::new(addr) .incoming() .expect("Couldn't set up server") .for_each(|conn| async { match...
Crate v0.9.0 2021-07-06
"The functional ML roots of the language, Graydon's first Rust compiler was written in OCaml, shine through, influencing it right from the start. It's..."

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.