tutorialedge.net
...JSJITorExpr) -> JSJITorExpr
{
match e
{
JSJITorExpr::Jit { label: label } => jump(label),
JSJITorExpr::Expr { expr: expr } => {
let rawexpr = *expr;
match rawexpr
{
JSExpr::Integer {..} => JSJITorExpr::Expr { expr: Box::new(rawexpr) },
JSExpr::String {..} => JSJITorExpr::Expr { expr: Box::new(rawexpr) },
JSExpr::OperatorAdd { lexpr: l, rexpr: r } => {
let l = eval(*l);
let r = eval(*r);
//call...
News & Blog Posts
2018-09-04
~8 min read
micheletti.io
...Filters now support boolean operators, parentheses, negation, and body/header matching:
method:POST & status:500
host:api.example.test & !path:/health
(status:401 | status:403) & header:authorization
type:json & response_body:error
proto:wss | proto:https
Adjacent terms are an implicit AND, so this works too:
method:POST host:api...
Project/Tooling Updates
2026-08-05
~10 min read
blog.servo.org
...mathieuh updated the Request constructor to match more recent specification changes.
impowski added Graphviz output of rust-bindgen’s IR
New Contributors
Dawing Cho
Eddie Quan
Gregory Katz
Huxley
Ian
Sam Liu
Jefry Lagrange
Neck Varentsov
vwvww
Ethan Glasser-Camp
Interested in helping build a web browser? Take a look...
Other Weeklies from Rust Community
2017-02-28
~1 min read
barretts.club
...With these ideas in mind, let's take a brief look at Rust's error handling!
let mut file_result = File::open("hello.txt");
match file_result {
Ok(mut file) => {
let mut data = String::new();
let _ = file.read_to_string(&mut data);
}
Err(e) => {
println!("error when reading file: {e...
Observations/Thoughts
2024-03-20
~4 min read
arxiv.org
...For other topics (e.g., related topics with language features such as structs, patterns and matchings, and foreign function interface), information is only available on Q&A websites while lacking in the official documentation. Finally, we discuss implications for programming language documenters, particularly how to leverage our approach to prioritize...
Research
2022-03-02
~1 min read
blog.guillaume-gomez.fr
...Request) -> Self::Future {
let path = req.path().to_owned();
::futures::finished(match *req.method() {
Get => {
let values = splitter(&path);
if values.len() != 1 || !self.rw.exists(&values[0]) {
Response::new().with_status(StatusCode::NotFound)
} else if let Some(mut file) = self.rw.get_file(&values[0], false) {
let mut out...
News & Blog Posts
2017-02-28
~10 min read
rust-lang.github.io
...An enum may be #[repr(transparent)] if it has exactly one variant, and that variant matches the same conditions which struct requires for transparency. Some concrete illustrations follow.
A union may be #[repr(transparent)] if it has exactly one non-zero-sized field:
// This union has the same representation as...
RFC 2645
RFC
2019-02-13
~8 min read
lpc.events
...It also provides other important benefits, such as improved error handling, stricter typing, sum types, pattern matching, privacy, closures, generics, etc.
Possible Rust for Linux topics:
Rust in the kernel (e.g. status update, next steps...).
Use cases for Rust around the kernel (e.g. subsystems, drivers, other modules...).
Discussions...
Virtual
2023-10-18
~1 min read
www.lpalmieri.com
...we can use a match statement for control flow - we behave differently depending on the failure scenario we are dealing with.
//! src/routes/subscriptions.rs
use actix_web::http::StatusCode;
// [...]
impl ResponseError for SubscribeError {
fn status_code(&self) -> StatusCode {
match self {
SubscribeError::ValidationError(_) => StatusCode::BAD_REQUEST,
SubscribeError::DatabaseError(_)
| SubscribeError::StoreTokenError...
Rust Walkthroughs
2021-05-19
~43 min read
blog.veeso.dev
...S) -> RemoteResult<String> { trace!("Running command: {}", cmd.as_ref()); let mut channel = match session.channel_session() { Ok(ch) => ch, Err(err) => { return Err(RemoteError::new_ex( RemoteErrorType::ProtocolError, format!("Could not open channel: {err}"), )) } }; if let Err(err) = channel.exec(cmd.as_ref()) { return Err(RemoteError::new_ex( RemoteErrorType::ProtocolError...
Observations/Thoughts
2025-01-08
~17 min read
swatinem.de
...L32, B64
}
impl<'data> ElfHeader<'data> {
pub fn parse(buf: &'data [u8]) -> Option<(Self, &'data [u8])> {
let (e_ident, _rest) = LayoutVerified::<_, ElfIdent>::new_from_prefix(buf)?;
if e_ident.e_mag != *b"\x7fELF" {
return None;
}
match e_ident.e_class {
// 32-bit
1 => {
match e_ident.e_data {
// LE
1...
Rust Walkthroughs
2022-08-10
~11 min read
usethe.computer
...Event) -> Result<(), Box<dyn Error>> {
self.state = match self.state {
ParserState::Between => {
match ev {
Event::Start(e) if e.local_name() == b"wcproduction" =>
ParserState::ProductionNeedAPI,
_ => ParserState::Between,
}
},
ParserState::ProductionNeedAPI => {
match ev {
Event::Start(e) => match e.local_name() {
b"api_st_cde" => ParserState::ReadAPIState,
b"api_cnty_cde" => ParserState::ReadAPICounty...
Observations/Thoughts
2020-10-28
~17 min read
natkr.com
...waker.clone() };
loop {
match fut.poll(&mut context) {
Poll::Ready(out) => return out,
Poll::Pending => waker.sleep_until_awoken(),
}
}
}
Just to be sure.. let's try it out before continuing. To make sure that
our wakeup works, and that we're actually sleeping when we can:
struct ImmediatelyAwoken(bool);
impl...
Rust Walkthroughs
2025-04-16
~10 min read
pramode.in
...enum Color {
Red,
Green,
Blue,
}
fn main() {
let c = Color::Green;
match c {
Color::Red => println!("Red"),
Color::Green => println!("Green"),
}
}
The exhaustive nature of the matching process is an important safety net.
Yaron Minsky’s Ocaml for the masses
has a list “destuttering” example which demonstrates the ease with...
News & Blog Posts
2016-09-06
~27 min read
pker.xyz
...The issue handler checks the current TID against our tracked PID
set (we use the lower 32 bits of bpf_get_current_pid_tgid(),
which is the thread ID, matching what the scheduler tracepoints
use). For buffered writes, the kernel's writeback threads
(kworker) are the ones that actually submit...
Project/Tooling Updates
2026-03-04
~13 min read
advancedresearch.github.io
...Reaches minimum value when reaching goal
Smooth gradient when getting closer to the goal
Rule agnostic
Easy to maintain
My first idea of how this heuristic should look like,
was something that used sub-expressions matching with the goal.
I was thinking about how difficult this would be to code...
Project Updates
2020-11-25
~5 min read
llogiq.github.io
...Then
the as_slice simply became a match over the three possible values
returning one of the three const references.
Now my iter just became self.as_slice().iter(), which was faster
than Option’s. Sorry if I start to bore you, but
ACHIEVEMENT UNLOCKED! :-)
For the final (and titular...
From the Blogosphere
2015-07-27
~4 min read
edunham.net
...make sure the claws are right.
Match the center front of the underside with the center of Ferris’s front
(both have a blue + on the pattern). Be sure the pieces have their right
sides together and the claws are sandwiched between them.
Match the points marked with red triangles...
News & Blog Posts
2016-05-23
~5 min read
owengage.com
...return true;
}
match current_state {
None => self.clear_cache(),
Some(si) => {
let cur = self.state(*si).clone();
if !self.clear_cache() {
return false;
}
// The unwrap is OK because we just cleared the cache and
// therefore know that the next state pointer won't exceed
// STATE_MAX.
*si = self.restore_state...
Rust Walkthroughs
2021-09-08
~4 min read
jamesmcm.github.io
...lambda_runtime::Context) -> Result<(), HandlerError> {
// Create clients here once since we will use them in all cases
let s3_client = S3Client::new(Region::EuWest1);
let ses_client = SesClient::new(Region::EuWest1);
let mut rt = tokio::runtime::Runtime::new().unwrap();
match e {
// Match on different events here...
}
}
Deployment
Now we are...
Learn More Rust
2020-09-04
~13 min read