Stream::unfold vs direct channel filtering
I have a struct where, you can call a function to get a sender or receiver channel, and a spawn function, the spawn spawns a proxy so you when you ask for the receiver it will give you an unbounded...
View ArticleUnderstanding memory reclamation in this lock-free structure
I found a very nice paper on intro to lock-free programming: https://erdani.org/publications/cuj-2004-10.pdf In this paper, just before reaching to conclusions, in the code snippet forUpdate; we never...
View ArticleSpeeding Up History
Some of us live on the command line. And for us, sometimes 'history' is our favorite command, allowing us to repeat a command we use all the time. Entering "history"(or our favorite shortened alias)...
View ArticleMatch-variants — C++ std::visit for Rust enums: static dispatch without the...
match-variants is an implementation of the C++ std::visit idea for Rust enums: preserve concrete types and static dispatch, while avoiding repetitive match boilerplate. Rust gives us two common ways...
View ArticleHow ownership is transferring in same vars?
let s = String::from("hello"); let tuple = (s, s.len()); // i am confused how ownership is moving b/w same vars i.e from first s to tuple s if all s are same ,how it's working??? 2 posts - 2...
View ArticleHow to get more advanced with Rust
Hi folks, I am from .NET background and just started to dive in Rust world, I've almost refined the unique fundamentals (though I have some unclosed gaps) from Rust Book and almost solved most of the...
View ArticleAwaiting async code in Drop
I currently have this struct in my code: /// auto flushes on drop struct Flusher<'a, W: AsyncWriteExt + Unpin>(&'a mut W); which I want to use to automatically flush my async file stream...
View ArticleHow to specify that two generic type parameters are the same type but have...
I am trying to use phf to create a compile time made hashmap, but this requires that the generic type has a static lifetime. I need to compare against the output of this hashmap, but it isn't working...
View ArticleIs it possible to quasiquote a concrete version of a generic type inside a...
I believe I've already found a workaround by just matching against the finite number of concrete types and passing the syn::type struct into the function manually, but it would be nice not to have to...
View ArticleCrate of the week quality rules
I'm wondering if that thread is still relevant when it's mostly an abundance of self-nominations for code written by LLMs... (sorry for the very few that obviously weren't, apparently 2?) Personally,...
View ArticleCc linkage error
Hi. I've tried xcode reinstalling, downgrading mac sdk to try and fix this cc linkage issue among other solutions online but none seem to work. error: linking with cc failed: exit status: 1 | = note:...
View ArticleLini 1.0, small language for diagrams and more, that compiles to SVG
Hey everyone, I've been working on lini for the past 4 months. It's now stable enough for v1.x, thought I'd share it here It's a small language for drawing figures from plain text, and one Rust binary...
View ArticleCreated a highly customizable generational arena
I made a generational arena that lets you pick the key size, the key layout and the storage of the arena. You can pick the integer types for the index and the generation, and whether a key stores them...
View ArticleRotate super-imposed images over each other
A better explanation is here: Rotate super-imposed images over each other - #4 by canina I have to use async to rotate two images over each other translucently. When trying myself I assumed I needed a...
View ArticleHello guys, my homemade 100% Rust IDE has finally make some of it good part,...
With only 2.4 MB on idle (depends on your device) at my phone it's can be lightweight I add some relaxing colors to it I add basic cmd so you won't have to get a Ph.D to learn it It has LSP support...
View ArticleUnderstanding UnwindSafe :)
hi folks! It's getting a bit difficult to wrap my head around this... Simply put, a type T implements UnwindSafe if it cannot easily allow witnessing a broken invariant through the use of catch_unwind...
View ArticleCode review on a multithreaded server
Good evening guys, I am new to rust and have been trying my best to adapt to the language, though i come from a Golang background. So, in the course of learning the language, I built this little...
View ArticleRten what is the best model to perform ocr on handwritting?
Using this library: GitHub - robertknight/rten: ONNX neural network inference engine · GitHub what is the best model to use to perform ocr on handwriting? let detection_model_data =...
View ArticleJason Walton's Abridged Official Rust book version is useful
At least for some people, or as a second read after the official Rust tutorial book. I just read the first 7 chapters of the shipped PDF version, and I think it is quite useful for refreshing my...
View ArticleHow to build expanding include_str!("__index.js") expanded to literal r#""#...
How to expand something like this, Rust source code referencing a file is src directory, in src/main.rs source code let js_code = include_str!("__index.js"); into this // Actual source code raw text...
View Article