ryanskinner.com
...This is what happens when your architecture matches React's design intentions.The Three Missing PiecesLooking back, I realize we'd shipped Rari with some architectural gaps. Not bugs—gaps. We could render React Server Components, but we weren't doing it the right way. Here's what we added...
Project/Tooling Updates
2025-10-29
~6 min read
lucumr.pocoo.org
...T) -> Value {
Value::from(ValueRepr::Object(DynObject::new(Arc::new(value))))
}
pub fn downcast_object_ref<T: 'static>(&self) -> Option<&T> {
match self.0 {
ValueRepr::Object(ref o) => o.downcast_ref(),
_ => None,
}
}
pub fn downcast_object<T: 'static>(&self) -> Option<Arc<T>> {
match self.0 {
ValueRepr::Object(ref o) => o...
Rust Walkthroughs
2024-05-22
~15 min read
blog.cloudflare.com
...Env) -> Result<Response> {
console_log!(
"{} {}, located at: {:?}, within: {}",
req.method().to_string(),
req.path(),
req.cf().coordinates().unwrap_or_default(),
req.cf().region().unwrap_or("unknown region".into())
);
if !matches!(req.method(), Method::Post) {
return Response::error("Method Not Allowed", 405);
}
if let Some(file) = req.form_data().await?.get...
Miscellaneous
2021-09-15
~3 min read
matklad.github.io
...impl<T> Drop for Node<T> {
fn drop(&mut self) {
loop {
match (self.left.take(), self.right.take()) {
(None, None) => break,
(None, Some(it)) | (Some(it), None) => *self = *it,
(Some(left), Some(right)) => {
*self =
*if left.depth > right.depth { left } else { right }
}
}
}
}
}
This requires maintaining the depths though. Can we...
Observations/Thoughts
2022-11-23
~4 min read
www.thespatula.io
...TcpStream) {
let mut ws = WebSocket::new(stream);
match ws.connect() {
Ok(()) => {
println!("WebSocket connection established");
match ws.handle_connection() {
Ok(_) => {
println!("Connection ended without error");
}
Err(e) => {
println!("Connection ended with error {:?}", e);
}
}
}
Err(e) => {
println!("Failed to establish a WebSocket connection: {}", e);
}
}
}
What happens here is we create our...
Observations/Thoughts
2024-07-24
~20 min read
llogiq.github.io
...This means I have to
match over all variants that could contain relevant subexpressions to take
care of the attributes. An accessor on Expr would have been very helpful
here.
When I finally thought that I had it figured out, I got an unhelpful error
during macro expanson. cargo expand...
News & Blog Posts
2018-11-13
~4 min read
morestina.net
...fn max_line(file_name: &str) -> io::Result<u64> {
// ...
}
This signature gives the callers freedom to decide how to handle the errors indicated by max_line – they can unwrap() the return value to panic in case of error, they can match the error and handle the error variant, or they...
Learn Simple Rust
2020-10-14
~11 min read
smallcultfollowing.com
...This operator desugars into a pattern match, but it has the effect of “propagating” the error to the caller of the function. If we look at the copy_data one more time, but imagine that any potential errors were propagated using results, it would look like:fn copy_data(from...
Observations/Thoughts
2022-02-02
~6 min read
hoverbear.org
...std::time::Duration::new(0, 0) }
}
}
fn to_filling(&mut self) {
self.state = match self.state {
State::Waiting { .. } => State::Filling { rate: 1 },
_ => panic!("Invalid state transition!"),
}
}
}
fn main() {
let mut state_machine = StateMachine::new();
state_machine.to_filling();
}
At first glance it seems okay. But notice some problems?
Invalid transition...
Blog Posts
2016-10-18
~18 min read
hoverbear.org
...std::time::Duration::new(0, 0) }
}
}
fn to_filling(&mut self) {
self.state = match self.state {
State::Waiting { .. } => State::Filling { rate: 1 },
_ => panic!("Invalid state transition!"),
}
}
}
fn main() {
let mut state_machine = StateMachine::new();
state_machine.to_filling();
}
At first glance it seems okay. But notice some problems?
Invalid transition...
Rust Walkthroughs
2025-04-16
~18 min read
www.fpcomplete.com
...Couldn't match type 'IO Int' with 'Int'
Expected type: [Int]
Actual type: [IO Int]
Instead, we need to use map's more powerful cousin, traverse (a.k.a. mapM, or "monadic map"). traverse allows us to perform a series of actions, and produce a new list with all of...
Miscellaneous
2020-10-14
~12 min read
arxiv.org
...On the NVIDIA B200 GPU, cuTile Rust achieves 7 TB/s for element-wise operations and 2 PFlop/s for GEMM (96% of cuBLAS), matching cuTile Python within measurement noise. Grout, a cuTile-Rust-based inference engine, exercises cuTile Rust across an end-to-end Qwen3 inference path. In batch...
Project/Tooling Updates
2026-06-17
~1 min read
blogsystem5.substack.com
...c_uint,
}It is very important to declare the structure as having a C representation so that its memory layout matches what the C compiler produces for the same structure. The kernel expects C semantics in its system call boundary, and we must adhere to that. Additionally, we must ensure...
Rust Walkthroughs
2025-02-19
~14 min read
rustc-dev-guide.rust-lang.org
...These can then be mapped to DefIds using TyCtxt::get_diagnostic_item() or checked if they match a DefId using TyCtxt::is_diagnostic_item(). When mapping from a diagnostic item to a DefId, the method will return a Option<DefId>. This can be None if either the symbol isn't...
Guide to Rustc Development
Book
2024-01-01
~4 min read
www.lpalmieri.com
...web::Data<PgPool>,
) -> HttpResponse {
let name = match SubscriberName::parse(form.0.name) {
Ok(name) => name,
// Return early if the name is invalid, with a 400
Err(_) => return HttpResponse::BadRequest().finish(),
};
let new_subscriber = NewSubscriber {
email: form.0.email,
name,
};
match insert_subscriber(&pool, &new_subscriber).await {
Ok(_) => HttpResponse::Ok().finish...
Rust Walkthroughs
2020-12-16
~31 min read
blog.digital-horror.com
...Vec<String> = domains.into_iter().map(|x| x.to_owned()).collect();
match mode {
EnrichmentMode::DnsLookup => {
// Ignore for now
}
EnrichmentMode::MxCheck => {
// Ignore for now
}
_ => return Err("enrichment mode not yet implemented"),
}
Ok(domain_store)
}https://github.com/JuxhinDB/twistrs/blob/ddc6facfeae818ea15a523d9a1e9fb04ce3e61fd/src/lib.rs#L601-L632The more astute reader might also...
Learn More Rust
2020-09-09
~14 min read
doc.rust-lang.org
...i32,
}
impl FromStr for Circle {
type Err = ParseIntError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.trim().parse() {
Ok(num) => Ok(Circle{ radius: num }),
Err(e) => Err(e),
}
}
}
fn main() {
let radius = " 3 ";
let circle: Circle = radius.parse().unwrap();
println!("{:?}", circle);
}
Rust by Example
Book
2024-01-01
~1 min read
rustc-dev-guide.rust-lang.org
...fn foo() {}
fn bar() {}
let a = match my_bool {
true => foo,
true if other_bool => foo,
false => bar,
}
In this example when type checking the match expression a LUB coercion is performed. This LUB coercion starts out with an initial lub ty of some inference variable ?x due to the...
Guide to Rustc Development
Book
2024-01-01
~12 min read
blog.arnedebo.com
...bind_slice! can be used to store a borrowed reference of whatever was matched inside into a bucket.
Parsing function signatures
#
We will now move to a slightly larger example, parsing a function signature grammar looking like this:
IDENT = 'a'..'z', { 'a'..'z' | '0'..'9' } ;
FN_SIGNATURE = 'fn', WHITESPACE, IDENT...
Rust Walkthroughs
2026-06-03
~9 min read
huonw.github.io
...1
2
3
trait Foo {
fn method(&self, other: &Self);
}
The types of the two arguments have to match, but this can’t be
guaranteed with a trait object: the erased types of two separate
&Foo values may not match:
1
2
3
4
5
impl<'a> Foo for Foo...
Blog Posts
2015-01-12
~9 min read