andreabergia.com
...pub fn push(&mut self, string: &str)
-> Result<(), ClassPathParseError> { /* ... */ }
/// Attempts to resolve a class from the various entries.
/// Stops at the first entry that has a match or an error.
pub fn resolve(&self, class_name: &str)
-> Result<Option<Vec<u8>>, ClassLoadingError> { /* ... */ }
}
The implementation of ClassPath will simply iterate through...
Observations/Thoughts
2023-08-30
~12 min read
github.com
...cargo make --profile mainnet build Verifying binary hash To verify that a deployed binary matches the source code, you may want to build it reproducibly and then verify that the SHA256 hash matches that of the deployed binary. The motivation behind this is to prevent malicious code from being deployed...
Crate
v1.2.0
2025-02-06
doc.rust-lang.org
pub fn read_line(&self, buf: &mut String) -> io::Result<usize>
...Examples
use std::io;
let mut input = String::new();
match io::stdin().read_line(&mut input) {
Ok(n) => {
println!("{n} bytes read");
println!("{input}");
}
Err(error) => println!("error: {error}"),
}
You can run the example one of two ways:
• Pipe some text to it, e.g., printf foo | path/to/executable...
method
std
Stable since 1.0.0
Version 1.100.0-nightly
www.greyblake.com
...impl Drink {
fn kind(&self) -> DrinkKind {
match self {
Drink::TapWater -> DrinkKind::TapWater,
Drink::Coffee(..) -> DrinkKind::Coffee,
Drink::Tea { .. } -> DrinkKind::Tea
}
}
}
And ability to iterate over all variants of DrinkKind:
impl DrinkKind {
fn all() -> Vec<DrinkKind> {
use DrinkKind::*;
vec![TapWater, Coffee, Tea]
}
}
The problem with the solution
The solution above will...
Rust Walkthroughs
2023-08-09
~3 min read
docs.rs
...Result<Package, _> = serde_path_to_error::deserialize(jd); match result { Ok(_) => panic!("expected a type error"), Err(err) => { let path = err.path().to_string(); assert_eq!(path, "dependencies.serde.version"); } } } License Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state...
Crate
v0.1.20
2025-09-15
doc.rust-lang.org
fn from_abstract_name<N>(name: N) -> crate::io::Result<SocketAddr>
...Examples
use std::os::unix::net::{UnixListener, SocketAddr};
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
fn main() -> std::io::Result<()> {
let addr = SocketAddr::from_abstract_name(b"hidden")?;
let listener = match UnixListener::bind_addr(&addr) {
Ok(sock...
associated_function
std
Stable since 1.70.0
Version 1.100.0-nightly
aloso.github.io
...Expr,) -> Option<Value> { match (kind, eval(vars, expr)?) { (UnExprKind::Not, Value::Bool(b)) => { Some(Value::Bool(!b)) } (UnExprKind::Neg, Value::Num(n)) => { Some(Value::Num(-n)) } _ => None, }}fn eval_binary( kind: BinExprKind, vars: &Variables<'_>, lhs: Expr, rhs: Expr,) -> Option<Value> { match kind { BinExprKind::Add => { if let Value::Num(lhs) = eval...
Rust Walkthroughs
2021-04-14
~10 min read
www.sea-ql.org
...let res = Bakery::insert_many(std::iter::empty()) .on_empty_do_nothing() // <- you needed to add this, // otherwise insert empty [] would lead to error .exec(db) .await;assert!(matches!(res, Ok(TryInsertResult::Empty)));
After careful consideration, we made a number of changes in 2.0:
removed APIs (e.g. Insert...
Project/Tooling Updates
2025-09-24
~9 min read
lucumr.pocoo.org
...impl Enumerator {
fn query_len(&self) -> Option<usize> {
Some(match self {
Enumerator::Empty => 0,
Enumerator::Values(v) => v.len(),
Enumerator::Iter(i) => match i.size_hint() {
(a, Some(b)) if a == b => a,
_ => return None,
},
Enumerator::RevIter(i) => match i.size_hint() {
(a, Some(b)) if a == b => a,
_ => return...
Observations/Thoughts
2024-08-28
~16 min read
lupyuen.github.io
...false,
},
14:15,
)
(StackSlot refers to the values in the constants array)
Let’s match the two…
Yep Abstract Syntax Trees can get deeply nested, like this for loop…
(See the complete Abstract Syntax Tree)
But Abstract Syntax Trees are actually perfect for converting Rhai to uLisp.
Lisp is a...
Rust Walkthroughs
2021-09-08
~24 min read
erickt.github.io
...ip::SocketAddr) -> libc::c_int {
unsafe {
let fd = match libc::socket(libc::AF_INET, libc::SOCK_STREAM, 0) {
-1 => panic!(),
fd => fd,
};
let mut storage = mem::zeroed();
let len = addr_to_sockaddr(addr, &mut storage);
let addrp = &storage as *const _ as *const libc::sockaddr;
match libc::bind(fd, addrp, len...
Blog Posts
2014-11-24
~16 min read
bevyengine.org
...This means 100% of the donations we receive go toward furthering our mission.Donations to Bevy Foundation (including all past donations that occurred this year) are now tax-deductible in the United States.Many employers have donation-matching programs for 501(c)(3)s. It is worth checking to see...
Project/Tooling Updates
2024-09-25
~2 min read
blog.paulme.ng
...is_match, find, captures.
A few lines of changes from using Captures to Matches reduce the running time by 2s.
Using dynamic programming to trace the best path in Viterbi decoding
I have speech processing and natural language processing background so I am quite familiar with hidden markov model training...
News & Blog Posts
2019-07-02
~7 min read
www.afloat.boats
...returns a value), we can assign the values to `tile_repr`
// And then write the value to the format "stream"
let tile_repr = match self {
TileType::Empty => "Empty",
TileType::Red => "Player Red",
TileType::Black => "Player Black",
};
write!(f, "{tile_repr}")
}
}
Compiles without a hitch!
And the browser console now logs...
Rust Walkthroughs
2025-08-27
~7 min read
rust-analyzer.github.io
#11461 (first-contribution) filter generics in Extract struct from enum variant.
#11531 (first contribution) make fill_match_arms assist handle #[doc(hidden)] and #[non_exhaustive].
#11535 (first contribution) add install instructions for Kakoune and Helix.
#11524 (first contribution) state that only the latest stable toolchain is officially supported.
#11424 pass...
Project/Tooling Updates
2022-03-02
~1 min read
crates.io
...If we implemented such without caring about background tasks, then this implementation will not match with the tokio's original implementation. Features Serde Support ( serde feature flag) Worker and NodeJS Support Test Utilities
Crate
v0.4.3
2025-09-01
smallcultfollowing.com
...After that, I will turn to virtual dispatch, impls,
and matching, and show how they interact.The Rust enumI don’t know about you, but when I work with C++, I find that the
first thing that I miss is the Rust enum. Usually what happens is
that I start...
Notable Links
2015-05-18
~5 min read
matthewkmayer.github.io
...if let Some(matches) = matches.subcommand_matches("generate") {
let services_config_path = matches.value_of("services_config").unwrap();
let service_configs = ServiceConfig::load_all(services_config_path)
.expect("Unable to read services configuration file.");
let out_dir = Path::new(matches.value_of("out_dir").unwrap());
commands::generate::generate_services(service...
News & Blog Posts
2017-07-18
~10 min read
freemasen.com
...u8) -> Self {
match v {
1 => Self::Legacy,
2 => Self::WriteAheadLog,
_ => Self::Unknown(v),
}
}
}
Let's just check in on a few things here. First we are deriveing a few more items,
PartialEq and Eq allow for using the == operator with 2 FormatVersions while
the PartialOrd and Ord allow for the...
Rust Walkthroughs
2020-11-18
~14 min read
github.com
...The migration lint will be implemented as follows:
* Find method calls matching the name of one of the newly added traits' methods.
This can be done either by hardcoding these method names or by setting up some
kind of registry through the use of an attribute on the relevant traits...
RFC 3114
RFC
2021-02-16
~6 min read