T
Hi all, i recently completed the rust programming language book and am also currently working on an embedded rust project, however i still fell like a newb, I really want to get into native applications and in general production grade programming in rust, but so far i cant really find any free resources on the internet. I really do want to improve programming in rust, and in general programming itself ( i am new to programming aswell so maybe this isnt really a rust issue ). Kindly Advise. 4…
T
Hi folks! Are you aware of any new/growing concurrency projects in the rust ecosystem which I could contribute to? Like projects that involve using atomics and stuff. Thanks! 1 post - 1 participant Read full topic
T
I'm writing a library that has a function like this: /// The returned closure does not need to be called, but doing so /// amuses the computer gremlins. pub fn foo() -> Result<impl FnOnce(), Box<dyn Error>> { // ... } It is perfectly valid to ignore the returned closure, but ignoring the closure generates the must_use compiler warning, "unused implementer of FnOnce that must be used". How can I disable that must_use attribute so that users of my library don't have to sprinkle in let _ = at each…
T
I own a full Arduino kit now, including Arduino UNO, stepper motor board and other things. But before that, I started learning Rust as my first serious programming language. So now I don't want to learn Arduino C++ just to use my kits, I want to use Rust for Arduino too. I heard that avr -hal for using that. But is it that much reliable? What's it's current condition? I have absolutely zero intention of learning Arduino C++. And my coding environment is fully on Termux in my phone, I don't have…
T
dataviz 1.0 is out: crates.io: Rust Package Registry It's a plotting crate with its own rasterizer (CPU, multi-core, or GPU via wgpu), 120+ chart types and interactive windows: use dataviz::prelude::*; let mut fig = Figure::new(900, 500); fig.axes().line(&x, &y).label("signal"); fig.show("demo")?; // zoom, pan, hover; or fig.save("plot.png") Highlights of the road to 1.0: grammar of graphics: Chart::new(data, Mark::Point).x("a").y("b").color("group").facet("site", 3) volume files (NIfTI, DICOM,…
T
I've been building Rcompiler, a compiler and interpreter written in Rust for my own programming language, Sema. I'm sharing it publicly and would appreciate feedback from people interested in compiler development, language design, and Rust as i have started my journey leaning it The repository includes documentation covering the language and its specifications. GitHub: GitHub - DtronicE/Rcompiler: A beginner-friendly custom programming language and interpreter, built with Rust, with a future…
T
I had a thought about the semver trick. Made a blog post out of it. SGued The semver trick is not backwards compatible if you wait 4 posts - 3 participants Read full topic
T
/* Your very first program in Rust :) For every lesson: play.rust-lang.org */ fn main() { let financial_management = "MCB"; // string type let credit_score = 800; // integer type has no decimal (float has decimal) let account_active = true; println!("{} manages my financial account.", financial_management); println!("Credit score: {}", credit_score); println!("Account active: {}", account_active); } (Playground) 2 posts - 2 participants Read full topic
T
I ran across this behavior when I had moved a constant outside the module and didn't get the diagnostic I was expecting. It was something like this: // const MISSING_CONST: &str = "foo"; fn main() { let bar = Some("bar"); matches!(bar, Some(MISSING_CONST)); // returns true, accepting any value in Some() } I expected the matches! to not allow an unused binding I guess, or at least warn. Constant-like bindings are similarly addressed here. I wonder if we could at least make it a different warning…
T
Hi everyone, I've published text_chipper, a Rust crate (with Python bindings via maturin) for splitting large text/Markdown files into token-budgeted chunks for RAG pipelines. Design highlights: Strict token budgets: Every finalized chunk is re-tokenized in the exact form it is returned (including heading-path prefixes), guaranteeing token_count <= max_length. If a single grapheme cluster exceeds the budget, it returns an error instead of emitting an oversized chunk. Grapheme-safe &…
T
Hello Rustaceans! I built SecretGuard, an open-source terminal privacy guard in Rust that intercepts API keys and credentials at the keystroke level before commands ever touch persistent disk (~/.zsh_history, ~/.bash_history) or local AI coding agent logs (Claude Code, Cursor). Why Rust? To make a pre-exec line-hook imperceptible, it has to run in microseconds. SecretGuard achieves 15.68 µs (0.016 ms) average scan latency across 1,000 synthetic commands with a 1.56 MB static binary footprint…
T
ihash 0.1.0 is a cross-platform non-cryptographic hash: 32 / 64 / 128 / 256-bit digests, extendable output, and a seekable keystream. In a 4-host benchmark (Apple M2 Max, Intel Xeon Platinum 8269CY, AMD EPYC, ARM Neoverse-N1), geometric-mean slice throughput is 19.84 GiB/s (gxhash4 17.74, foldhash_fast 10.07, xxh3 8.45). The mixed-key HashMap benchmark reaches 38.9 Mop/s. All 32 / 64 / 128 / 256-bit variants pass all 20 SMHasher3 suites with zero failures. Output is bit-identical across x86_64,…
T
0 is generally considered to be positive unless there's something i'm missing. 16 posts - 10 participants Read full topic
T
Hi all! I've been building Razorwire, an open-source (MIT) proxy that sits between an AI agent and its model provider (anything OpenAI-compatible). When the model asks for a tool call, Razorwire checks it against a YAML policy before the agent sees it. Blocked calls are removed from the response, so the agent has nothing to run. The README opens with a real run: an agent told to drop the staging and production databases. Without Razorwire both are gone; with one policy rule, production…
T
Hello, I'm new in Rust and programming itself, Rust is my first serious language. My coding environment is Termux right now in my phone. This is my GitHub link, there are some small projects there, I'll be glad to receive reviews. GitHub MD-FAHAD25624 - Overview New in coding and computers, currently coding in Termux. - MD-FAHAD25624 3 posts - 2 participants Read full topic
T
Hi everyone, I'm working on a student management platform and looking to add an in-app messaging feature so students and teachers can chat, create group conversations and stay connected without having to switch between different apps. I've been exploring a few options, including MirrorFly, Sendbird and Rocket.Chat, but haven't settled on one yet. For those who've integrated chat into an existing application, which solution worked best for you? I'm particularly interested in how easy it is to…
T
The next step I'm about to take in polishing redbook is to find a better way to handle one of the ffi calls which returns a DST[1]. The "correct" definition of the struct would be: pub(crate) struct DeviceDetails { cbSize: u32, DevicePath: [u16], } I currently have the workaround, that relies on assumed knowledge of the maximum likely path length: pub(crate) struct DeviceDetails { cbSize: u32 = const {size_of::<SP_DEVICE_INTERFACE_DETAIL_DATA_W>() as u32}, DevicePath: [u16; MAX_PATH_CHARS] =…
T
Is there a preferred way to run a benchmark that takes one or more files as inputs? (The input files are going to be checked into the repository, but the benchmark binary would ideally take files to process as command line arguments.) Right now I am using include_str! to embed the test files in the benchmarks, but this is a little inflexible for my taste and also means I can't measure the effect of different ways of reading files from disk. 7 posts - 3 participants Read full topic
T
Hello, I want to make a derive macro that creates an struct of array version of a struct. I'm just having trouble figuring out how to make it nicely work especially with the methods. For instance a get(idx: usize) method would return an instance of the base struct from the values in its SoA version's Vec's at the specified index. I don't know how to go about doing so. Here is my macro: use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{parse_macro_input, DeriveInput,…
T
Hi everyone I was reading about ownership, but as I carried on reading and began to understand the issue much better, I came across the topic of Refcell and OnceCell. I tried to read a bit about them, but I still can’t quite grasp the difference between them, what they’re used for, or when to apply them. Thanks a lot 6 posts - 4 participants Read full topic
T
situation I use git worktrees (admittedly a bit more than necessary). My main project is a cargo workspace. In Cargo.lock, I see around 550 (direct and indirect) crate dependencies. Looking at the target/debug/build directory, that results in 400 rlib files. The workspace itself has most of its code in lib crates (mostly aranged to minimize dependencies for dependees which depend on me) and a few bins. In target/debug/incremental there are around 850 .o files from the workspace crates. A full…
T
I wanted to write: vec![NAN, 1.0, NAN]; So I tried: use std::f64::NAN; But Clippy warns against using legacy numeric constants and recommends f64::NAN instead. Naturally, I tried: use f64::NAN; But that doesn't compile, and the compiler suggests use std::f64::NAN instead. So I've come full circle error[E0432]: unresolved import `f64` --> src/main.rs:6:9 | 6 | use f64::NAN; | ^^^ | help: a similar path exists | 6 | use std::f64::NAN; | +++++ I know I can use f64::NAN everywhere or define a local…
T
Here is the usage. I want to have a DataSource<dyn Trait> instead of the origin type, but as operator does not work here. Unsafe code is allowed, but I still have no idea. The trait is provided externally, that is to say I don't know what trait the user will coerce to. How can I implement this coercion? Thanks. use std::cell::RefCell; use std::rc::Rc; pub struct DataSource<T: ?Sized> { current: RefCell<Rc<T>>, } impl<T: ?Sized> DataSource<T> { pub fn new(init: Rc<T>) -> Rc<Self> { Rc::new(Self…
T
Website GitHub Web Demo After exactly a year of development, Tessera v3.0.0 is finally done. This release changed the framework itself so much that it feels like a new one, even though the ideas behind it are still the same. A quick introduction: Tessera is a reactive, retained-mode UI framework built on Rust and wgpu. I started it to explore how to build UIs that feel natural to write in Rust, run fast, and leave room for you to extend them. What it used to be Tessera UI used to be an…
T
After 10 years of contributing to Apache Cassandra, I needed to see another side of databases. Apache Cassandra is a powerful database, but it is also a complex one to operate and use. Two years ago, I had some free time and started digging into how other databases had managed to improve their usability. At the same time, I wanted to learn Rust and needed a project to build real experience with it. What started as an experiment turned into 15 months of full-time development, and the result is…
T
I have code which performs chunked reads of framed data via an (unsafe) ioctl call, with the following basic shape (after removing a load of additional validations, abstractions, etc): let zeroes = Box::<[u8]>::new_zeroed_slice(frames.size()); // SAFETY: `\0` is valid as `u8` let mut buf = unsafe { zeroes.assume_init() }; let chunk_bufs = buf.chunks_mut(self.chunk_size()); for chunk_buf in chunk_bufs { // SAFETY: we own the underlying buffer, which is not moved and well-sized unsafe {…
T
I work on Tuist. We just shipped Cargo support in CLI 4.218.0. tuist cargo build caches rustc outputs, including workspace crates. The key is based on what rustc and build scripts actually read. Checkout and toolchain paths are replaced with placeholders, so a checkout at a different path on the same machine can reuse the same entries. Every rustc invocation also shows up with how long it took. tuist cargo test looks at CI runs of the same commit and flags tests that only fail sometimes. You…
T
I am working on Bulkparse at Bulkgrid. It’s an MIT-licensed Rust library that converts PDFs, Word documents, Excel spreadsheets, PowerPoint presentations and other popular formats into Markdown and structured JSON. The focus is fast conversion, memory efficiency and preserving document structure. We did a 200 PDF benchmark, where Bulkparse processed the whole corpus in 0.440 seconds, 40% less conversion time than the next-fastest tested configuration. It achieved the highest reading-order,…
T
Consider the trait below. A Parser is a type which can take an input string and turn it into a bunch of candidate result. Each candidate stores: (1) the byte index up until which the result was found, and (2) a number of substrings that have been captured. pub trait Parser { type Iter<'txt> : Iterator<Item = (usize, Vec<&'txt str>)>; fn parse<'me, 'txt>(&'me self, input : &'txt str) -> Self::Iter<'txt>; } It is important that a parser's result is liftetime-independent of its output: a parser…
T
I have the following code fn main() { let text = ".?;,!!!"; println!("{:?}", norm(text)); let text = ".?;,!!"; println!("{:?}", norm(text)); let text = ".?;,!"; println!("{:?}", norm(text)); } fn norm<'a>(splittersp: &'a str) -> (&'a str, bool) { let mut res = false; let splitters = if let Some(stripped) = splittersp.strip_suffix("!!") { if splittersp.len() > 2 { if splittersp.chars().nth_back(2).unwrap() != '!' { &splittersp[..splittersp.len() - 1] } else { res = true; stripped } } else {…