Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
pwy.io
...Date| -> Span { // Check if `curr` matches any of the `BYDAY` rules // (evaluates to `true` if `by_day` is empty) let matches_by_day = recur.by_day.iter().any(|wd| { curr.weekday() == wd }); // Check if `curr` matches any of the `BYMONTHDAY` rules // (evaluates to `true` when `by_month_day` is empty...
Observations/Thoughts 2025-04-23 ~23 min read
rust-lang.github.io
Summary Tuple structs can now be constructed and pattern matched with Self(v1, v2, ..). A simple example: struct TheAnswer(usize); impl Default for TheAnswer { fn default() -> Self { Self(42) } } Similarly, unit structs can also be constructed and pattern matched with Self. Motivation This RFC proposes a consistency fix allowing Self...
RFC 2302 RFC 2017-01-18 ~6 min read
siciarz.net
...MATCH Option,166,9,/home/zbyszek/Development/Rust/rust/src/libcore/option.rs,Enum,pub enum Option<T> { MATCH Item,774,11,/home/zbyszek/Development/Rust/rust/src/libcore/option.rs,Struct,pub struct Item<A> { MATCH None,168,4,/home/zbyszek/Development/Rust/rust/src/libcore/option.rs,EnumVariant...
24 Days of Rust continues! 2014-12-15 ~2 min read
cbreeden.github.io
...usize) -> Test { match n { 0 => Test::A, 1 => Test::B, _ => unreachable!(), } } We will need to fill in those branches with #(#match_usize)*. After that, the iterator is quite easy to implement. Match the current count with an enum variant, increment the count, and return that enum. That seems straightforward. So...
News & Blog Posts 2017-01-03 ~11 min read
unconj.ca
...These two processes can be represented using a simple function that makes use of Rust’s match construct: fn algae_rule(input: Algae) -> Vec<Algae> { match input { Algae::A => vec!(Algae::A, Algae::B), Algae::B => vec!(Algae::A) } } If we take the Algae type as representing the L-system...
Notable Links 2015-06-07 ~7 min read
doc.rust-lang.org
...use std::collections::HashMap; fn call(number: &str) -> &str { match number { "798-1364" => "We're sorry, the call cannot be completed as dialed. Please hang up and try again.", "645-7689" => "Hello, this is Mr. Awesome's Pizza. My name is Fred. What can I get for you today?", _ => "Hi...
Rust by Example Book 2024-01-01 ~1 min read
bodil.lol
...fn identifier(input: &str) -> Result<(&str, String), &str> { let mut matched = String::new(); let mut chars = input.chars(); match chars.next() { Some(next) if next.is_alphabetic() => matched.push(next), _ => return Err(input), } while let Some(next) = chars.next() { if next.is_alphanumeric() || next == '-' { matched.push(next); } else { break; } } let...
News & Blog Posts 2019-04-23 ~54 min read
www.youtube.com
...P GE 100 and then matcher and there's loads of built-in matches there's wildcard matches if you don't care about specific arguments comparisons floating points string matches container matches you also compose matches together so you can say maybe you don't care that the robot...
Video 2018-02-06
crates.io
...In order for the filter to match, it is enough that one rule associated to the system call matches. A system call may also map to an empty rule vector, which means that the system call will match, regardless of the actual arguments. The following diagram models a simple filter...
Crate v0.5.0 2025-03-07
doc.rust-lang.org
pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool
u8::eq_ignore_ascii_case — Checks that two values are an ASCII case-insensitive match. This is equivalent to to_ascii_lowercase(a) == to_ascii_lowercase(b). Examples let lowercase_a = 97u8; let uppercase_a = 65u8; assert!(lowercase_a.eq_ignore_ascii_case(&uppercase_a));
method core Stable since 1.23.0 Version 1.100.0-nightly
github.com
...BytesMut = "*2\r\n+Foo\r\n+Bar\r\n".into(); let total_len = bytes.len(); let (frame, amt, buf) = match decode_bytes_mut(&mut bytes) { Ok(Some(result)) => result, Ok(None) => panic!("Expected complete frame"), Err(e) => panic!("{:?}", e) }; assert_eq!(frame, expected.0, "decoded frame matched"); assert_eq...
Crate v6.0.0 2024-11-15
docs.rs
...Examples From a file match imagesize::size("example.webp") { Ok(size) => println!("Image dimensions: {}x{}", size.width, size.height), Err(why) => println!("Error getting dimensions: {:?}", why) } From a vector let data = vec![0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x64, 0x00, 0x64, 0x00]; match imagesize::blob_size(&data) { Ok(size) => println...
Crate v0.15.0 2026-07-09
hassamuddin.com
...Packet ) { match packet { Packet::Pingreq => { println!("Ping"); framed.send(Packet::Pingresp).await; } _ => { // now what? } } } pub async fn handle_client( stream: TcpStream, addr: SocketAddr ) { let mut framed = Framed::new(stream, MQTTCodec::new()); // do connection handshake let connect = match framed.next().await { Some(Ok(Packet::Connect(packet))) => { framed.send(Packet::Connack( Connack...
Learn More Rust 2020-09-04 ~7 min read
blog.cloudflare.com
...It’s built using our engine, Wirefilter, which takes powerful boolean expressions written by customers and matches incoming requests against them. Customers can then choose how to respond to traffic which matches these rules. We will discuss some in-depth optimizations we have recently made to Wirefilter, so you may...
Miscellaneous 2020-09-30 ~11 min read
doc.rust-lang.org
fn eq_ignore_ascii_case(&self, other: &Self) -> bool
AsciiExt::eq_ignore_ascii_case — Checks that two values are an ASCII case-insensitive match. Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries. Note This method is deprecated in favor of the identically-named inherent methods on u8, char, [u8] and str.
method std Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
OsString::shrink_to_fit — Shrinks the capacity of the OsString to match its length. See the main OsString documentation information about encoding and capacity units. Examples use std::ffi::OsString; let mut s = OsString::from("foo"); s.reserve(100); assert!(s.capacity() >= 100); s.shrink_to_fit(); assert_eq!(3...
method std Stable since 1.19.0 Version 1.100.0-nightly
doc.rust-lang.org
...Within $() is $x:expr, which matches any Rust expression and gives the expression the name $x. The comma following $() indicates that a literal comma separator character must appear between each instance of the code that matches the code in $(). The * specifies that the pattern matches zero or more of whatever...
The Rust Programming Language Book 2024-02-01 ~17 min read
tech.marksblogg.com
...fn main() { let matches = command!() .arg(arg!(--function <VALUE>).required(true)) .get_matches(); let function = matches.get_one::<String>("function").expect("required"); loop { let mut input = String::new(); match io::stdin().read_line(&mut input) { Ok(n) => { if n == 0 { // End files break; } let mut result = match function.as_str...
Rust Walkthroughs 2023-09-20 ~4 min read
rust-analyzer.github.io
...layer. #10689 handle pub tuple fields in tuple structs. #10720 don’t ascribe types in pattern completion for param patterns twice. #10747 remove faulty logic for ascending test attributes for runnables. #10762 trigger flyimport on enum variants. #10759 make add_missing_match_arms applicable at the end of the match.
Project/Tooling Updates 2021-11-17 ~1 min read
tweedegolf.nl
...messageBytes, message_type } = received; assert.strictEqual(sender, alice_identifier, "Sender does not match Alice's identifier"); let receivedMessage = String.fromCharCode.apply(null, messageBytes); assert.strictEqual(receivedMessage, message, "Received message does not match"); assert.strictEqual(message_type, MessageType.SignedAndEncrypted, "Message type does not match SignedAndEncrypted"); } else { assert.fail(`Unexpected message type...
Rust Walkthroughs 2024-10-02 ~7 min read
"(...) complexity in programming is just like energy in physics: it cannot be created, nor destroyed, but only transformed. So, if a programming langua..."

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.