zenoh.io
...This effort has been undertaken for three main reasons:To avoid ambiguity in key expression definition and matching, which before could lead to undefined behaviour.To improve the key expression matcher for better performance.To allow future extensibility to be introduced for more complex matching and behaviours.Briefly, we can...
Project/Tooling Updates
2022-10-19
~8 min read
doc.rust-lang.org
pub mod result
...A simple function returning Result might be defined and used like so:
#[derive(Debug)]
enum Version { Version1, Version2 }
fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
match header.get(0) {
None => Err("invalid header length"),
Some(&1) => Ok(Version::Version1),
Some(&2) => Ok(Version::Version2),
Some(_) => Err("invalid version...
module
core
Stable since 1.0.0
Version 1.100.0-nightly
blog.yoshuawuyts.com
Async Cancellation I— 2021-11-10
tasks and futures
cancelling futures
cancelling tasks
propagating cancellation for futures
propagating cancellation for tasks
patching cancellation propagation
structured concurrency
cancelling a group of tasks
halt-safety
should tasks be detachable?
an async trait which can't be cancelled?
intermediate matching on cancellation?
defer...
Observations/Thoughts
2021-11-17
~24 min read
gigapotential.dev
...Create a VM
let val = unsafe { hv_vm_create(std::ptr::null_mut()) };
match val {
HV_SUCCESS => println!("HV_SUCCESS: The operation completed successfully."),
HV_ERROR => eprintln!("HV_ERROR: The operation was unsuccessful."),
HV_BUSY => eprintln!(
"HV_BUSY: The operation was unsuccessful because the owning resource was busy."
),
HV_BAD...
Rust Walkthroughs
2026-04-22
~10 min read
marcobacis.com
...In the previous post, I implemented the policy update in this way:async fn next(&self, _request: &HttpRequest) -> String {
// Read servers list
let servers = &self.servers;
let max_server_idx = servers.len() - 1;
// Update index
let idx = self
.idx
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |idx| match idx {
x if...
Rust Walkthroughs
2024-06-05
~8 min read
kobzol.github.io
...HashSet<(ObjectName, Ident)>,
}
impl Visitor for CheckNotNullWithoutDefault {
type Break = ();
fn pre_visit_statement(&mut self, statement: &Statement) -> ControlFlow<Self::Break> {
if let Statement::AlterTable {
operations, name, ..
} = statement
{
for op in operations {
match op {
AlterTableOperation::AddColumn { column_def, .. } => {
let has_not_null = column_def
.options
.iter()
.any(|option| option.option == ColumnOption...
Observations/Thoughts
2025-03-26
~6 min read
forgestream.idverse.com
...true,
})
} else {
None
}
}
fn main() {
let user_id = 12;
match find_user_by_id(user_id) {
Some(user) => match user.get_greetings() {
Ok(message) => println!("{}", message),
Err(err) => println!("Error: {}", err),
},
None => println!("User not found."),
}
}
What is happening is that:
The script will find a user by the id...
Observations/Thoughts
2025-08-06
~4 min read
kerkour.com
...Q, user: &User) -> Result<(), Error> {
const QUERY: &str = "INSERT INTO users (id, email)
VALUES ($1, $2)";
sqlx::query(QUERY)
.bind(user.id)
.bind(&user.email)
.execute(db)
.await
.map_err(|err| match err {
sqlx::Error::Database(db_err) if db_err.constraint().is_some() => Error::EmailAlreadyInUse,
err => Error::Unspecified(format...
Rust Walkthroughs
2025-04-02
~6 min read
docs.rs
...42, }; match syslog::unix(formatter) { Err(e) => println!("impossible to connect to syslog: {:?}", e), Ok(mut writer) => { writer.err("hello world").expect("could not write error message"); } } } The struct syslog::Logger implements Log from the log crate, so it can be used as backend for other logging systems: extern crate...
Crate
v7.0.0
2024-07-26
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shr(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the >> operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shr which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn wrapping_shl(self, rhs: u32) -> Self
...Instead, the behaviour of this method matches what shift instructions do on many processors, and is what the << operator does when overflow checks are disabled, but numerically it's weird. Consider, instead, using Self::unbounded_shl which has nicer behaviour.
Note that this is not the same as a rotate...
method
core
Stable since 1.2.0
Version 1.100.0-nightly