llogiq.github.io
...We can also check the inputs if they match the output type and return them instead. Lastly, we may still
switch argument order, e.g.
fn foo(x: usize, y: usize) -> bool {
let (x, y) = if MU::now(42) { (y, x) ] else { (x, y) }
..
}
Note that we have to take...
News & Blog Posts
2018-02-20
~2 min read
blog.1password.com
...When signing in to Google, all Login items with a matching username are automatically sorted to the top.AccessibilityWe want everyone to be able to access their accounts with ease. That's why we followed the web accessibility spec defined by WAI-ARIA, the Accessible Rich Internet Applications Suite when...
News & Blog Posts
2019-12-10
~2 min read
dtrace.org
...And (of course) match is an expression as well – and I found that I often use match where I would have used a ternary operator in C, with the added benefit that I am forced to deal with every case. As a concrete example, take this code that is printing...
Observations/Thoughts
2020-10-14
~19 min read
github.com
...affect termination,
which has no practical value, thus remaining unimplemented
* although more useful than loops, conditional control flow (`if`/`else` and
`match`) also remains unimplemented and only `match` would pose a challenge
* immutable `let` bindings in blocks have the same status and implementation
difficulty as `if`/`else` and they both...
RFC 911
RFC
2015-02-25
~7 min read
rustacean-station.org
...Most loved programming
language
00:28:28 clippy book
00:29:40 Rolling co-lead roles for T-compiler
00:36:33 Hyper vs Rocket - Low Level vs Batteries included
Rust is surprisingly
expressive
(2013) by Steve Klabnik
00:40:00 Macro Patterns - A match made in heaven by Conrad...
Observations/Thoughts
2022-06-29
~2 min read
blog.chainsafe.io
...Msg) -> Cmd<Self, Msg> {
match msg {
Msg::Increment => self.count += 1,
Msg::Decrement => self.count -= 1,
Msg::Reset => self.count = 0,
}
Cmd::none()
}
}
Looking at the code above, there are a few things to notice. First, we specify that we are implementing sauron's Application trait and specify that we...
Rust Walkthroughs
2022-04-20
~6 min read
blog.meilisearch.com
...a floating value ranging from 0 to 1; 1 is a fully semantic search; 0 is an exact, match-focused full-text search; the default is 0.5 which mixes both methods.
Your control over the semantic ratio directly influences how search results are ranked. A higher semantic ratio shifts...
Project/Tooling Updates
2024-01-17
~6 min read
arzg.github.io
...I guess we should head back to utils.rs and write up another function.pub(crate) fn extract_op(s: &str) -> (&str, &str) {
match &s[0..1] {
"+" | "-" | "*" | "/" => {}
_ => panic!("bad operator"),
}
(&s[1..], &s[0..1])
}
#[cfg(test)]
mod tests {
// snip
#[test]
fn extract_plus() {
assert_eq!(extract_op("+2"), ("2...
Learn More Rust
2020-09-09
~10 min read
dev.to
...fold tag characters back to ASCII before matching, so the smuggled text becomes visible to every rule at once.
A false positive I'm glad I caught. My exfil rule fired on the bare word exfiltration — which meant it blocked "How do I prevent data exfiltration from my network?" A...
Observations/Thoughts
2026-07-15
~11 min read
blaz.is
...for<'cglue_b> Future<Output = CGlueAOutput>,
{
let (this, ret_tmp, cglue_ctx) = cont.cobj_pin_mut();
let ret = {
/* Note the fourth block being placed here */
cx.with_waker(|waker| {
let mut cx = ::core::task::Context::from_waker(waker);
match this.poll(&mut cx) {
::core::task::Poll::Ready(v) => {
out.write...
Project/Tooling Updates
2024-08-07
~6 min read
www.abubalay.com
...Pin<&mut Self>, r: () + Self::Resume) -> Self::Yield + Self::Output {
let state = self.project().state;
match state {
State::Done => { panic!() }
State::Iter => match self.project().iter.next() {
None => { *state = State::Done; None }
Some(item) => { *state = State::Call(f(item)); self.resume(()) }
}
State::Call(c) => match c.resume(r) {
item: B...
Observations/Thoughts
2024-01-17
~24 min read
docs.rs
...EncodeState<W>) -> (Poll<W, Error>, EncodeState<W>) {
match state {
EncodeState::Start(mut start_state) => {
match start_state.poll() {
Ok(Async::Ready(())) => {
let (iter, sink) = start_state.finish();
Self::poll_next_part(iter, sink)
}
Ok(Async::NotReady) => (Ok(Async::NotReady), EncodeState::Start(start_state)),
Err(err) => {
(Err(err), EncodeState::Invalid)
}
}
}
EncodeState...
News & Blog Posts
2019-08-13
~6 min read
github.blog
...Note that our single-threaded performance is only matched when using eight threads.) The second figure shows the worst case complexity difference between our linear, Huggingface’s heap-based, and tiktoken’s quadratic implementation.
The rest of this post details how we achieved this result. We explain the basic principle...
Miscellaneous
2024-12-18
~11 min read
blog.sheerluck.dev
...The only prerequisite is that you have read the previous articles in this series, as I will assume you know ownership, borrowing, structs, enums, pattern matching, error handling, generics, traits, and lifetimes.
Get the source code here
What is Box<T>
Before we talk about closures, we need to understand...
Rust Walkthroughs
2026-06-03
~15 min read
endler.dev
...That’s a lot of code for printing file names and metadata and a big attack surface!“Rust can only ever match C performance at best and is usually slower”Work by Trifecta shows that it is possible to write Rust code that is faster than C in some cases...
Observations/Thoughts
2025-10-01
~6 min read
kellnr.io
...To accomplish this, we'll
use the regex crate for pattern matching.
use regex::Regex;
pub struct Email {
email: String,
}
impl TryFrom<&str> for Email {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, Self::Error> {
// Note that this is not a 100% correct regex for email validation...
Observations/Thoughts
2023-06-21
~10 min read
guillaumegomez.github.io
...documentation.
@QuietMisdreavus updated rustdoc to print non-self arguments of bare functions and struct methods on their own line.
@kmcallister updated Arc docs to match new Rc docs.
@liigo updated rustdoc to inline sidebar items, to display more in a page.
@sinkuu made E0243/E0244 message consistent with E0107.
@christopherdumas...
Other weeklies from Rust community
2016-10-04
~2 min read
www.chriskrycho.com
...get_matches();
let path = args.value_of(path_arg_name)
.expect("You didn't supply a path");
let search = String::from(path) + "/**/*.cha";
let paths = glob(&search)
.expect("Could not find paths in glob")
.map(|p| p.expect("Bad individual path in glob"));
for path in paths {
match fs::rename...
News & Blog Posts
2016-11-15
~6 min read
smallcultfollowing.com
...Match expressions.Ref bindings can also appear in match expressions, of course.
Regardless, I think the semantics of match on an rvalue probably ought
to be that the temporary value lives as long as the enclosing
statement, regardless of what bindings it contains; that seems to be
what most people...
Announcements, etc
2014-01-11
~11 min read
www.ecorax.net
...u32) -> Self { Self(s) }
pub fn side(&self) -> u32 { self.0 }
}
// Convenience fallible API
impl Shape {
pub fn radius(&self) -> Result<u32, &'static str> {
match self {
Shape::Square(_) => Err("Only circles have a radius"),
Shape::Circle(c) => Ok(c.radius()),
}
}
pub fn side(&self) -> Result<u32, &'static str> {
match self...
Rust Walkthroughs
2021-06-02
~19 min read