news.ycombinator.com
...I think "the design of Rust does not guarantee the possibility of matching C++ performance unless you use unsafe code" is too strong a statement.
> Rust does not guarantee the possibility of matching C++ performance unless you use unsafe code.As with any performance question, this is hard to actually...
Notable Links
2015-02-16
~14 min read
timvisee.com
...Now I only had to find 4 pieces with edges that
didn't match any other edge. In the example above the tiles, T3, T2, T7, and T8
all have 2 edges that don't match any other. Rather simple. That worked.
In part 2 I use tricks like just...
Rust Walkthroughs
2021-03-03
~23 min read
registerspill.thorstenball.com
...Ok(body)
}
_ = tokio::time::sleep(Duration::from_millis(2500)) => {
finish.abort();
Err(anyhow::anyhow!("timeout"))
}
}
}How is that even possible — do the error types match? Doesn’t matter, it works here because guess what, the Result<String> in the return type — that’s not the Result that you learned about...
Miscellaneous
2024-10-30
~3 min read
diziet.dreamwidth.org
...A will definitely work if B matches V..W, and Optimistic: We have no reason to think B breaks with any of V..W.
At first sight the latter does not seem useful, since how would the package manager find a working combination? Taking Debian as an example, which uses...
Rust Walkthroughs
2022-01-05
~14 min read
matklad.github.io
...rand also provides flexible trait-based “plugin”
interface, allowing you to mix and match different combinations of
PRNGs and algorithms. User interface of rand is formed
primarily by extension traits.
Kinds Of Randomness
Circling back to the beginning of the post, it is very important to
distinguish between the two...
Observations/Thoughts
2023-01-11
~3 min read
blog.thoughtram.io
...Whenever we use references, Rust tries to assign them a lifetime that matches the constraints by how their used. Here’s a simple example of that:
fn main() {
let r;
{
let x = 1;
r = &x;
}
println!("{}", r)
}
We introduce a variable r, that receives a reference to x in the...
Learn Simple Rust
2020-10-21
~9 min read
v5.chriskrycho.com
...This is exactly the right choice for Swift, and not a perfect match for what Rust would need, but it is suggestive of the right direction. ↩︎
Observations/Thoughts
2024-05-08
~4 min read
git-cliff.org
...🧰 Other
(log) Add trace log about which command is being run - (a9b2690)
(bitbucket) Match PR and release metadata correctly (#907) - (e936ed5)
(changelog) Include the root commit when --latest is used with one tag (#901) - (508a97e)
(config) Add the 'other' parser to the default config - (12cb1df)
(git) Improve docs for...
Project/Tooling Updates
2024-11-20
~3 min read
lwn.net
...For the last several years, gccrs has
been targeting parity with rustc version 1.49 and a matching old
version of the kernel. The project chose to do that to avoid chasing an
endlessly moving target while trying to get basic functionality working at all;
eventually, however, it will be...
Rust Walkthroughs
2026-10-07
~9 min read
yeslogic.com
...scope = ReadScope::new(&buffer);
let font_file = scope.read::<FontData<'_>>()?;
// Construct Font instance
let provider = font_file.table_provider(opts.index)?;
let mut font = match Font::new(provider)?
.expect("unable to find suitable cmap subtable");
};
// Map glyphs
let glyphs = font.map_glyphs("some text", MatchingPresentation::NotRequired);
// Shape glyphs
let script...
Project/Tooling Updates
2020-12-23
~3 min read
www.arroyo.dev
...We need to repeat the definitions (or include them from a common library), but we’ll also include one more, an owned version of PluginValue:pub enum OwnedPluginValue {
Bool(bool),
Int(i64),
UInt(u64),
Double(f64),
String(CString),
}
impl PluginValue {
pub fn to_owned(self) -> OwnedPluginValue {
match self {
PluginValue::Bool...
Rust Walkthroughs
2024-06-05
~24 min read
rust-dd.com
...Request) -> impl Responder {
TakoWs::new(req, |mut ws| async move {
let _ = ws.send(Message::Text("Welcome to Tako WS!".into())).await;
while let Some(Ok(msg)) = ws.next().await {
match msg {
Message::Text(txt) => {
let _ = ws
.send(Message::Text(Utf8Bytes::from(format!("Echo: {txt}"))))
.await;
}
Message::Binary(bin) => {
let _ = ws...
Project/Tooling Updates
2025-11-12
~3 min read
kaylynn.gay
...DoubleEndedIterator> Iterator for Bidirectional<I> {
type Item = I::Item;
fn next(&mut self) -> Option<I::Item> {
match self {
Bidirectional::Forward(iter) => iter.next(),
Bidirectional::Reversed(iter) => iter.next(),
}
}
}
impl<I: DoubleEndedIterator> DoubleEndedIterator for Bidirectional<I> {
fn next_back(&mut self) -> Option<Self::Item> {
match self {
Bidirectional::Forward(iter) => iter.next...
Observations/Thoughts
2022-01-05
~19 min read
blog.stillinbeta.com
...Self::Message) -> bool {
match msg {
Ok(DenMessage::Update(update)) => self.handle_gauge(update),
// stay tuned for part 3!
}
}
All handle_gauge will do is update the fields of the application which look like this.
Listing 4: den-head/src/lib.rspub struct App {
bus_arrivals: LastUpdate<Vec<BusLine>>,
//snip
}
Listing...
Rust Walkthroughs
2024-01-17
~8 min read
www.lpalmieri.com
...We need to act on the error returned by basic_authentication:
//! src/routes/newsletters.rs
// [...]
#[derive(thiserror::Error)]
pub enum PublishError {
// New error variant!
#[error("Authentication failed.")]
AuthError(#[source] anyhow::Error),
#[error(transparent)]
UnexpectedError(#[from] anyhow::Error),
}
impl ResponseError for PublishError {
fn status_code(&self) -> StatusCode {
match self {
PublishError::UnexpectedError...
Rust Walkthroughs
2021-09-01
~50 min read
www.ahmadrosid.com
...Result<ws::Message, ws::ProtocolError>, ctx: &mut Self::Context) {
match msg {
Ok(ws::Message::Ping(msg)) => {
self.hb = Instant::now();
ctx.pong(&msg);
}
Ok(ws::Message::Pong(_)) => {
self.hb = Instant::now();
}
Ok(ws::Message::Text(text)) => ctx.text(text),
Ok(ws::Message::Binary(bin)) => ctx.binary(bin),
Ok(ws::Message...
Rust Walkthroughs
2022-03-23
~3 min read
lwn.net
...For the last several years, gccrs has
been targeting parity with rustc version 1.49 and a matching old
version of the kernel. The project chose to do that to avoid chasing an
endlessly moving target while trying to get basic functionality working at all;
eventually, however, it will be...
Observations/Thoughts
2026-09-30
~9 min read
mackow.ski
...If the password changes, the hash no longer matches, and the user is securely logged out.
Similarly, static file hashing allows us to append a content-based version string (e.g., /static/image.png?v=64bd8d843deb) to URLs. This enables aggressive browser caching while ensuring users always get the latest...
Project/Tooling Updates
2026-03-18
~3 min read
bencher.dev
...fn main() { for i in 1..=100 { match (i % 3, i % 5) { (0, 0) => println!("FizzBuzz"), (0, _) => println!("Fizz"), (_, 0) => println!("Buzz"), (_, _) => println!("{i}"), } }}
Create a main function
Iterate from 1 to 100 inclusively.
For each number, calculate the modulus (remainder after division) for both 3 and 5.
Pattern match...
Miscellaneous
2024-02-28
~18 min read
www.abubalay.com
...This means the signature may not match the actual function, in which case the compiler produces garbage, and the call will probably corrupt the stack or similar.
Each foreign function must be called following certain rules (e.g. “only call this once,” “only call this from one thread at a...
Observations/Thoughts
2020-08-26
~9 min read