minikin.me
...ComparisonMode) -> bool {
match mode {
ComparisonMode::Strict => self.name == other.name && self.price == other.price,
ComparisonMode::IgnorePrice => self.name == other.name,
}
}
}
fn main() {
let product1 = Product {
name: String::from("Laptop"),
price: 999.99,
};
let product2 = Product {
name: String::from("Laptop"),
price: 999.99, // Same price
};
let product3 = Product {
name: String::from...
Observations/Thoughts
2025-01-29
~4 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...
Call for Participation
2021-09-08
~1 min read
github.com
...That is, we must do something like:
```rust
fn deserialize_from(dest: &mut MyBigEnum) -> Result<(), Error> {
let tag = deserialize_tag()?;
match tag {
A => {
let payload = deserialize_a()?
*dest = A(payload);
}
..
}
Ok(())
}
```
We must construct the entire payload out-of-place, and then move it into place at the end, even...
RFC 2195
RFC
2017-10-30
~13 min read
blog.servo.org
...added support for ARM 32-bit and 64-bit cross-compiles to our CI
kichjang redesigned parts of the script event loop to better match the HTML specification’s task queue concept.
prashant made it possible to choose between EGL and OpenGLES on Linux
rebstar6 enabled click events to be...
News & Blog Posts
2016-03-21
~1 min read
doc.rust-lang.org
...Result<i32>) {
match result {
Ok(n) => println!("The first doubled is {}", n),
Err(e) => println!("Error: {}", e),
}
}
fn main() {
let numbers = vec!["42", "93", "18"];
let empty = vec![];
let strings = vec!["tofu", "93", "18"];
print(double_first(numbers));
print(double_first(empty));
print(double_first(strings));
}
Rust by Example
Book
2024-01-01
~1 min read
blog.yoshuawuyts.com
Tide Channels— 2020-01-29
why channels?
which apis do we need?
channel states
api design
registering a new channel
registering external channel handlers
using channels inside endpoints
matching channels with remote peers
disconnects
heartbeat
interface overview
future directions
group support
http/2 push streams
summary
WebSocket (WS) support for...
News & Blog Posts
2020-01-28
~14 min read
lwn.net
...Kent Overstreet, instead, argued
that the Rust abstractions are a way to design a cleaner interface, and
that this interface should not need to match the C API. Cleaning up the
latter is "a giant hassle" due to the need to change all existing
filesystems at the same time, while...
Project/Tooling Updates
2024-01-31
~7 min read
micouy.github.io
...fn g2(thing: &Thing) -> &String {
&(*thing).field
// ┃ ┗━ Point directly to the referenced data.
// ┗━━━ Create a reference to the expression's value with a matching lifetime.
}
I'm still not sure how Rust determines what lifetime the newly created reference should have. It has been pointed out that *thing is not...
Observations/Thoughts
2022-03-23
~4 min read
predr.ag
...TL;DR + section index
cargo-semver-checks queries today are slow because many items need to be matched across API versions to their counterparts with the same name. Currently, that's an O(n^2) process (the sweet spot of poor scaling), but can optimized down to O(n).
In...
Observations/Thoughts
2023-02-08
~16 min read
heikoseeberger.de
...String) { match MetadataKey::from_bytes(key.as_bytes()) { Ok(key) => match MetadataValue::try_from(&value) { Ok(value) => { self.0.insert(key, value); } Err(error) => warn!(value, error = format!("{error:#}"), "parse metadata value"), }, Err(error) => warn!(key, error = format!("{error:#}"), "parse metadata key"), } }}
With that Injector implementation we can define a...
Rust Walkthroughs
2023-08-30
~3 min read
slint-ui.com
...Fix some documentation links (#1575)
And add a test in the CI that checks for warnings in the internal
crates
(Also changed --exclude in the test to match the one from build, since
c++ test are run separately)
Remove erroneous mention of SLINT_FEATURE_EVENTLOOP_WINIT_ALL (#1572)
We used...
Project/Tooling Updates
2022-09-07
~4 min read
wasmi-labs.github.io
...Slightly slower than its direct counterpart, but has a slightly better memory footprint.Simple but efficient loop-match based instruction dispatch similar to how Wasmi 1.0 dispatch works.Ideally, it will make use of both become keyword,
and #[loop_match] attribute, once those features are stabilized. 13This is just...
Project/Tooling Updates
2025-12-03
~10 min read
rust-java-tutorials.netlify.app
...this will collide with other impl Ridable that happen to match Bicycle
// ...
#[test]
fn take_a_ride_test(){
let mut bike = BasicBicycle::default();
bike.take_a_ride();
assert!(bike.get_speed() == 10);
}
Note that in current stable rust (version 1.5.3), looks like rust doesn't allow to define...
Observations/Thoughts
2021-07-07
~4 min read
dawchihliou.github.io
...VecDeque<&mut BinaryTree<T>> = VecDeque::new();
queue.push_front(self);
loop {
let BinaryTree {
ref mut left,
ref mut right,
..
} = queue.pop_back().unwrap();
match left {
Some(node) => {
queue.push_front(node);
}
None => {
*left = Some(Box::new(BinaryTree::new(new_value)));
return;
}
}
match right {
Some(node) => {
queue.push_front(node);
}
None...
Observations/Thoughts
2022-01-19
~9 min read
guillaumegomez.github.io
...Damn! It was a close call!!)
@MichaelNecio noted that shadowing never destroys a value.
@matklad simplified wording.
@withoutboats corrected the docs on str::trim_matches.
@kennytm fixed markdown formatting error of E0277, E0310 and E0502.
@ollie27 fixed rustdoc static and const generation of redirect pages and improved char::to_{lower...
New Crates & Project Updates
2016-06-20
~1 min read
grpc.io
...The Tonic codegen interface will continue to be supported to allow users to
upgrade to the new transport implementation without needing to rewrite their
application.Going forward, you can expect the gRPC team to continue adding new features
and providing ongoing maintenance of the grpc crate, matching our other
supported...
Project/Tooling Updates
2026-05-27
~1 min read
fast.github.io
...That matches a lot of failures.
But some of the nastiest problems aren’t a single line of causality. Validation can fail in five places at once. A batch operation can partially succeed. Timeouts can come with partial results. Those want something closer to a set or a tree of...
Rust Walkthroughs
2026-01-07
~9 min read
seanmonstar.com
...The purpose of the roadmap is to map out what hyper looks like now, and exactly how it needs to change to match up with the VISION.
The roadmap starts by describing current known issues with hyper v0.14, after having spoken to many users.
Then, after using the tenets...
Observations/Thoughts
2022-04-06
~1 min read
jamesmcm.github.io
...Auto Ref in pattern matching
I couldn’t find an RFC for this, but it’d great to be able to use a
static &str when matching on an enum containing a String. i.e. so
this would be possible:
enum MyEnum {
WithString(String),
Other,
}
fn main() {
let myenum = MyEnum...
Call for Blog Posts
2020-09-30
~10 min read
www.ecorax.net
...u8) {
assert!(in_range(port, index));
let register = match port {
'A' => 0x0001000,
/*...*/
} as *mut u32;
*register |= 1 << index;
}
Yeah, don't do that.
Why am I bringing it up? Because now that we have some
scaffolding in the form of unique, managed Pin structs, it doesn't really seem
that...
Rust Walkthroughs
2021-04-21
~16 min read