adventures.michaelfbryan.com
...We just need to handle the on_key_pressed() event and match
on the key that was pressed, returning a Transition::ChangeState if it’s
a button we support.
// demo/src/modes/idle.rs
impl State for Idle {
fn on_key_pressed(
&mut self,
_drawing: &mut dyn Drawing,
event_args...
News & Blog Posts
2020-02-11
~41 min read
doc.rust-lang.org
...iterator, returns an (Optional) String
for line in lines.map_while(Result::ok) {
println!("{}", line);
}
}
}
// The output is wrapped in a Result to allow matching on errors.
// Returns an Iterator to the Reader of the lines of the file.
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io...
Rust by Example
Book
2024-01-01
~1 min read
iohk.io
...our team, learn more about our projects, and get a real sense of our culture and ways of working.Offer03If it’s a good match, we'll move to offer, complete a background check, and prepare to welcome you through onboarding.From day one, we want you to feel informed...
Rust Jobs
2020-10-07
~1 min read
rust-lang-nursery.github.io
...Option<String>,
},
}
fn main() {
let args = NotesArgs::parse();
if args.color {
println!("Enabled syntax highlighting");
}
match args.command {
Commands::New { title, body } => {
// Prints:
// TITLE: ...
// BODY: ...
println!(
"Creating new note!\nTITLE: {}\n{}",
title,
if let Some(body) = body {
format!("BODY: {}", body)
} else {
"".into()
}
);
}
Commands::List => println!("Listing available tasks"),
Commands::Delete...
The Rust Cookbook
Book
2024-01-01
~2 min read
seanmonstar.com
...back out:
match req.headers.get() {
Some(&ContentType(Mime(Application, Json, _))) => "it's json!",
Some(&ContentType(Mime(top, sub, _))) => "we can handle top and sub",
None => "le sad"
}
Here’s an example that makes sure the format is correct:
req.headers.set(Date(time::utc_now()));
// ...
match req.headers.get...
Blog Posts
2014-12-22
~5 min read
www.capturedlambda.dev
...Vec<Item> = Vec::new();
customer.fetch_shopping_list(&mut items);
for item in items.iter_mut() {
match store.fetch_item(item) {
Response::Available => {
mark_as_available(&mut item);
continue;
}
Response::NotAvailable => continue;
// this early return is why we are
// splitting looking up the items
// and actually loading them into
// the...
Observations/Thoughts
2025-04-23
~19 min read
smallcultfollowing.com
...To a human, this is clearly an ImportDecl;
in particular, it matches this production:ImportDecl = "import" Path "." "*" ";"
But to the computer, this is not a match at all. The second thing
listed after "import" should be a path not an identifier. Now of
course there is a rule that lets...
News & Blog Posts
2016-03-07
~12 min read
blog.eldruin.com
...It seems the measurements match the humidity, rather than the CO2 concentration. I made other measurements with an iAQ-Core-C sensor I got from MOUSER and these did resemble what one would expect. I will publish those here soon.Possibly my CCS811 is simply worn off. If you are...
Project Updates
2020-09-16
~4 min read
boats.gitlab.io
...Most of my functions with many return paths terminate with a match statement. Technically, these
could be reduced to a single return path by just wrapping the whole match in an Ok, but I don’t
know anyone who considers that good form, and I certainly don’t. But an...
News & Blog Posts
2020-04-07
~15 min read
news.ycombinator.com
Hadean | Systems Programmer | London | ONSITE, VISAWe're looking for a brilliant systems-level implementor to join us in London, or potentially remote, who matches ≥6 of the following: • loves C
• loves Rust
• has a wide array of ambitious self-directed projects
• has got their hands dirty writing technically complex systems...
fn work(on: RustProject) -> Money
2017-01-10
~1 min read
community.nlnetlabs.nl
...These functions took their arguments by reference, but implementing the correct behaviour required that they take it by value. (#501)
Added
Added Blob::get_functions_by_signature to get all the functions in a Blob that match a given signature. Thanks, @algernon! (#494)
Make FunctionRetrievalError and TypeMismatch public. Thanks, @algernon...
Project/Tooling Updates
2026-11-25
~1 min read
bytecodealliance.org
...There is ongoing work to determine how best to use all of these; for example, the Wasm spec interpreter is not well-suited to running large programs (it is designed to match the spec formalisms exactly, rather than for speed) and so we are not running it in that way...
Project/Tooling Updates
2021-12-15
~12 min read
blog.servo.org
...One of our contributors, Florian Duraffourg, landed a patch recently that switched our public domain list matching source and algorithm, resulting in a huge speedup in page load times (~25%!). Shing Lyu tracked down and measured this unexpectedly-large gain through a new automated page load testing performance infrastructure that...
New Crates & Project Updates
2016-06-27
~1 min read
taping-memory.dev
...pub async fn handle_connections(&mut self) {
loop {
let ev = self.next_event().await;
let ev = match ev {
Ok(ev) => ev,
Err((e, i)) => {
eprintln!("Socket error: {e}");
self.read_connections.remove(&i);
self.write_connections.remove(&i);
continue;
}
};
match ev {
Event::Read((dest, items)) => {
let Some(writer) = self.write...
Observations/Thoughts
2025-08-13
~43 min read
mbuffett.com
...Vec<TokenTree> = item.into_iter().collect();
let literal = match &input.get(0) {
Some(proc_macro2::TokenTree::Literal(literal)) => literal.to_string(),
_ => panic!(),
};
The approach works, but it’s a bit strange
dealing with a Literal. For example I had to trim the quote characters off
myself, as there didn’t...
Observations/Thoughts
2021-05-05
~5 min read
codethoughts.io
...ColumnOption::Default(_), .. } => {
152 has_default = true;
153 }
154 _ => {}
155 }
156 }
157
158 if has_not_null || has_default {
159 datatype
160 } else {
161 format!("Option<{datatype}>")
162 }
163}
164
165166fn extract_table_name(from: &Vec<TableWithJoins>) -> Option<String> {
167 match from.first() {
168 Some(table_with_joins) => match &table_with...
Observations/Thoughts
2024-10-02
~16 min read
rust-analyzer.github.io
...VS Code allows installing VSIX files that don’t match your platform. Please don’t do that.
If you’re running a 32-bit version of VS Code on a 64-bit Windows system, please install the 64-bit version of Code instead. This configuration used to work thanks to...
Project/Tooling Updates
2021-12-29
~1 min read
thekeeper.io
...user=user, 42≠99, logged=logged, in=in → 3 of 4
match (0.75 ≥ 0.4), so it merges. The single differing slot is generalized to a wildcard:
4-token shard
└─ user
└─ <*>
└─ #1 user <*> logged in (size 2) ← "42" and "99" collapsed to <*>
3. user 7 logged in. Same leaf...
Project/Tooling Updates
2026-07-08
~15 min read
rust-lang.github.io
...Except for the cases handled below, these operations produce results that exactly match IEEE 754-2008 (with roundTiesToEven [except for float-to-int casts, which round towards zero] and default exception handling without traps, without abruptUnderflow/flush-to-zero). % matches the behavior of fmod in C (this operation is not...
RFC 3514
RFC
2023-10-14
~25 min read
rust-lang.github.io
...Many constructs like match and if, which use curly braces, also do not require semicolons when they begin a statement.
Drawbacks
• This introduces a difference between different macro invocation delimiters, where previously there was no difference.
• This requires the use of semicolons in a few places where it was not...
RFC 378
RFC
2014-10-09
~2 min read