rvarago.github.io
...λ> EAdd (EInt 10) (EBool False)
Triggers a type-error:
• Couldn't match type ‘Bool’ with ‘Int’
Expected: Expr Int
Actual: Expr Bool
• In the second argument of ‘EAdd’, namely ‘(EBool False)’
In the expression: EAdd (EInt 10) (EBool False)
In an equation for ‘it’: it = EAdd (EInt 10) (EBool...
Rust Walkthroughs
2025-10-22
~4 min read
ferrous-systems.com
...usb::StandardRequest) {
defmt::debug!("request: {}", req);
match req {
usb::StandardRequest::GetDescriptor {
descriptor,
length,
} => {
match descriptor {
Descriptor::DeviceQualifier => todo!(),
// .. omitted other cases ..
}
},
// .. omitted other cases ..
}
}
Then you can execute cargo run to run your embedded program on the target device.
No new Cargo subcommand with new flags to learn; just the...
Miscellaneous
2020-08-11
~9 min read
supermarket.chef.io
...To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
Project Updates
2015-04-13
~1 min read
audunhalland.github.io
...use unimock::*;
#[test]
fn my_function_should_add_two_numbers() {
let deps = mock([
your_function::Fn::each_call(matching!())
.returns(1)
.in_any_order(),
some_other_function::Fn::each_call(matching!())
.returns(2)
.in_any_order(),
]);
assert_eq!(3, my_function(&deps));
}
Deeper integration tests with entrait and unimock
A...
Rust Walkthroughs
2022-06-08
~10 min read
nadrieril.github.io
...HasPlace>, {
// uhhh
}
Pattern-matching
Pattern-matching is based on places, and we can make it work with custom places too!
fn foo(x: MyPtr<Option<Foo>>) {
match *x {
Some(ref foo) => ...,
None => ...,
}
}
// compiles to:
fn foo(x: MyPtr<Option<Foo>>) {
let d = (&raw const x).read_discriminant(empty_projection!(Option...
Observations/Thoughts
2025-11-19
~21 min read
www.chiark.greenend.org.uk
...syntax
"Macros by example" macro_rules!
Procedural macros proc_macro
Practicalities
build.rs
Async Rust
Introduction
Fundamentals
Innards
Practicalities
Choosing a runtime
Mixing and matching sync and async; thread context
Pin
Anonymous future types, traits, etc.
Cancellation safety
Send
Error messages
Libraries and utilities
FFI
Raw C FFI
FFI support...
Miscellaneous
2021-09-29
~1 min read
www.theverge.com
...It includes a new design with a dark mode that better matches some of the recent UI improvements across Windows 10 and Windows 11. 1Password is also now built on Rust, to improve performance.The entire desktop app now looks a lot more like the web or 1Password browser extension...
Miscellaneous
2021-11-17
~1 min read
github.com
...Note that this can only be done with a compiler that already supports `i128`/`u128` to match the calling convention that LLVM is expecting.
Here is the list of functions that need to be implemented:
```rust
fn __ashlti3(a: i128, b: i32) -> i128;
fn __ashrti3(a: i128, b: i32) -> i128...
RFC 1504
RFC
2016-02-21
~4 min read
smallcultfollowing.com
...one can view a lifetime as a set of
paths through the control-flow graph, in which case the points after
the match or after the if would appear on only on paths that
happened to pass through the right arm of the match. They are
“conditionally included”, in other...
News & Blog Posts
2016-05-16
~16 min read
serokell.io
...The Analysis team manages FOSSA CLI and FOSSA Broker, along with services that power more advanced capabilities like snippet scanning and vendored code matching.
This is our second interview with FOSSA. Our previous conversation, featuring Eliza Zhang from the company’s engineering team, focused on the use of Haskell in...
Observations/Thoughts
2024-02-14
~7 min read
www.fornjot.app
...I think I understand the problem (the coordinate systems of coincident curves don't match), but there are some subtleties to the solution. In my first few attempts, any fix I tried broke something else.
This is frustrating, because this really shouldn't be that hard. But it is hard...
Project/Tooling Updates
2023-02-15
~1 min read
seanmonstar.com
...Error) -> Next {
match err {
Error::Timeout => {
// we could try to be good and repond with a 408
self.code = hyper::StatusCode::TimedOut;
Next::write()
},
_ => {
// oh noes, just blow up
Next::remove()
}
}
}
Waiting
So far, the described API works well when the server can respond immediately to each event on a...
News & Blog Posts
2016-03-28
~4 min read
doc.rust-lang.org
...a>(accounts: &Accounts<'a>,
username: &'a str, password: &'a str){
println!("Username: {}", username);
println!("Password: {}", password);
println!("Attempting logon...");
let logon = Account {
username,
password,
};
match accounts.get(&logon) {
Some(account_info) => {
println!("Successful logon!");
println!("Name: {}", account_info.name);
println!("Email: {}", account_info.email);
},
_ => println!("Login failed!"),
}
}
fn main(){
let...
Rust by Example
Book
2024-01-01
~1 min read
rust.cologne
...labeled break/continue
higher-kinded types
pattern matching in unusual places
path specific visibility
…
We’ll explain a few of them and show example use-cases. If you can think of something that fits the
bill feel free to bring your own examples.
After that we will move to open...
Europe
2023-09-06
~1 min read
www.rodrigoaraujo.me
...Detecting which instruction a given u16 value is, i.e., what’s the OpCode?
Matching it against all possible OpCodes
Running the matching OpCode and extracting the operands from the whole instruction.
The first two parts are pretty simple:
pub fn execute_instruction(instr: u16, vm: &mut VM) {
// Extract OpCode...
Rust Walkthroughs
2021-09-01
~43 min read
taping-memory.dev
...The non-pattern matching condition expression of an if or while expression, or a match guard.
The body expression for a match arm.
Each operand of a lazy boolean expression.
The pattern-matching condition(s) and consequent body of if (destructors.scope.temporary.edition2024).
The entirety of the tail expression...
Observations/Thoughts
2025-07-09
~23 min read
blog.scaleway.com
...I like advanced features like generics, optional types, pattern matching, and proper error management, so Rust seemed more appropriate than Go.
The project would have run the same on Python... But with the hassle of having to manage the dependencies everywhere we want to deploy it, or having to create...
Observations/Thoughts
2021-11-24
~4 min read
github.com
...The app code looks something like:
```rust
// search for "#define FOO nnn"
fn find_c_defines(input: &str) {
let rx = Regex::new(r#"^#define\s+(\w+)\s+([0-9]+)\s*(//(.*))?"#).unwrap();
for captures in rx.captures_iter(input) {
let my_match: Match = captures.get(1).unwrap();
do_some_work(my...
RFC 3191
RFC
2021-11-01
~21 min read
oakchris1955.eu
...Read<Error = E> + Write<Error = E> + Seek<Error = E>,
{
fn get_ro(&self) -> &dyn ReadOnly<E> {
match self {
Self::ReadOnly(ro) => ro,
Self::ReadWrite(rw) => rw,
}
}
fn get_rw(&self) -> Option<&dyn ReadWrite<E>> {
match self {
Self::ReadOnly(_ro) => None,
Self::ReadWrite(rw) => Some(rw),
}
}
}
The whole idea was to...
Observations/Thoughts
2025-07-23
~10 min read
lwn.net
...Is this
code the correct way to do it?
loop {
match timeout(Duration::from_secs(5), rx.recv()).await {
Ok(Ok(msg)) => process(msg),
Ok(Err(_)) => return,
Err(_) => println!("No messages for 5 seconds"),
}
}
As is typical of code shown on slides, this example is somewhat terse. In this
case...
Observations/Thoughts
2025-09-24
~7 min read