XIO

xWire

Posts from every feed QUEST has found across the web — blogs, news, podcasts, channels and more.

The Rust Programming Language Forum - Latest posts

Latest posts

Rolling upgrades in tellus: old code cannot learn a new shape

During a rolling upgrade, old and new nodes of a cluster exchange messages while their types change. Old code cannot learn a new shape, so in tellus the new code bridges both ways: it upcasts what old nodes send, and it downcasts what it sends to them. My latest blog post shows how that looks in code, with the Schema trait and the cluster demo's Pong, which changed shape between two versions of the demo application: Heiko Seeberger Rolling upgrades in tellus: old code cannot learn a new shape…

Fail-closed allowlist on streamed JSON events: walking serde_json::Value vs typed structs?

Quick update: I made the change, and while doing it I found a real bug of exactly this kind. The proxy split the stream into lines at \n only. But the SSE spec, and the OpenAI Python SDK, also end a line at a lone \r. So a line like this: : nothing to see\rdata: {"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"name":"db_drop"}}]}}]} was one comment line to the proxy, but a comment and then a data line to the client. The tool call in it was never checked. It needs a hostile…

Where does ownership and borrowing rules shine?

The classic example where it shines in a single-threaded context is iterator invalidation. If I write: const CLEAR_THE_DECKS: u32 = 42; let mut input = vec![]; // Code filling in the Vec for item in input { if item == CLEAR_THE_DECKS { input.clear() } The borrow checker rejects my code because I'm mutating the same Vec<u32> (input) while I've also got it borrowed so that I can iterate over it. In general, safe Rust enforces, at compile time, that you either have exactly one way to refer to…

Does anyone actually length-check CStr::from_ptr?

Jookia: Maybe a bodge here is to have a length check on 32-bit systems that panics? Note (as a complete aside) that whether that length check is needed or not is itself platform-dependent. On client editions of Windows, for example, the 32 bit platform has a 2G/2G split between user and kernel addresses, and thus you cannot have an allocation longer than 231 bytes in size; you can when running a 32 bit binary on a 64 bit platform, though. Thus, there will be some 32 bit platforms where a length…

Where does ownership and borrowing rules shine?

Rust rules are indeed most important for multi-threading. But even in single-threaded code, without those rules, problems like dangling pointers could arise. What might be a bit difficult to understand for a beginner is, why even in single-threaded code only one exclusive mutable reference is allowed. Details are explained in most Rust books, e.g. see Ownership and memory management - Rust for C-Programmers

Where does ownership and borrowing rules shine?

Hi everyone! Do concepts like ownership and borrowing specifically exist in Rust to prevent UB in multithreaded context? (In multithreaded env, it's quite clear: forcing the spawned thread to take ownership of a String. This prevents other threads from modifying it at the same time.) Or it's applications shine in single threaded contexts as well? Thanks!

Fail-closed allowlist on streamed JSON events: walking serde_json::Value vs typed structs?

Thanks, that's really helpful. I hadn't thought about the check and the client reading the same bytes differently. Right now it checks the parsed Value but forwards the original bytes, so I'll switch to re-serializing what was checked and sending that. That way the agent only ever gets exactly what passed the check.

Does anyone actually length-check CStr::from_ptr?

That's an interesting read. I've been trying to think about how much of an issue this is. Looking at pointer - Rust it's pretty clear that allocations are never bigger than isize::IMAX which is interesting. The main problem here I see is that CStr::from_ptr is a rare case of not knowing the size up front, so you should be length checking it to something sane. However the length checking I would expect is usually done after conversion to a Rust CStr, not before. Is having a single C string…

Do you think we should need a Express like easy backend framework in rust?

Like most of devs I also came from nodejs and that's why I am wondering if Rust users also think this is a need? I do vibecoded a express like backend framework for my own use but still because it's only me developing and checking all the edge cases it's not happening very fast. actually it's some other project on cargo I don't find the sources of it on github so i downloaded it from cargo itself then added lots of features into it and renamed it nitrox the github has the most updated code it…

Crate of the Week

I nominate i_overlay, a crate that provides geometrical operations on polygons and line segment chains, including boolean operations, slicing, offsetting, and spatial predicates. Internally, all this is done using integer coordinates (not floats), which makes the operations numerically robust. First release was in 2023. It's used for polygon offsetting and boolean operations in geo. I'm not affiliated with this project -- just found it to be very useful.

Rust on Arduino

First, thanks for being so helpful. And I'm pretty new to Rust too, I've just completed 8 beginner level projects, nothing else. And I was asking that since I own an Arduino kit and wanted to combine my programming learning with my electronics kit. And I haven't yet started coding for Arduino, but I'm aware it's usually done with Arduinodroid or Termux too.

Rust on Arduino

Okay, so I am going to do a ton of searching. Trying to find it, but if I cannot, do you want to try and make a crate with me? It would probably be super useful to have it. Plus, Arduino C++ is not the same as normal C++, but only the commands to interact with the Arduino is different. If I cannot find anything, I will create a repo on GitHub and send you the link here, and the results of my search. If you need anything else, send me a message here and I will respond tomorrow.

Non-`must_use` closure (`FnOnce` or `FnMut` or `Fn`)?

Looking at existing FnOnce implementors … you could probably (ab-)use AssertUnwindSafe for this same purpose (Should be logically basically a no-op in case of an impl FnOnce because you can't put an impl FnOnce into any broken state while unwinding - as it can only be called once [even if that one call panicks], anyway. Though to generalize to related cases: YMMV how “correct” an application of AssertUnwindSafe may be in cases of FnMut or Fn.) pub mod mylib { use std::{ boxed::Box,…

Is there a tool for automatically transpossing my module structure?

The tool I started writing for this is at a point where its usable, but it's still missing features (you can't go to mod.rs, only the other way) and needs a few more tests. it has safety checks build in to prevent it from running if you have uncommitted changes (can be disabled with -force), overwriting files, or manipulating the contents of hidden folders (like .git). I'll release it when it's done, anyone who wants to use it can build it from source now if they want to. I don't know what to…

How to get better at rust

Joraspberry: i cant really find any free resources on the internet. The book "Effective Rust" is available online and quite good: Effective Rust - Effective Rust I have listed a few other learning resources at Appendix - Rust for C-Programmers -- a few links might have changed, I will update them soon. But I am unsure if that will help you to find a job, which might be your real intention. And only reading or watching videos might not be sufficient, you might need some years of practice working…

What's everyone working on this week (47/2026)?

Finally got one of my iOS app working well enough to release it. I wrote it in ~2018 in Swift, but now it's Rust. Next, I can release on Android and Windows with same code base. It's an app for drawing mandalas, reflected symmetric strokes, on a tablet. So the GPU stuff went from Metal to WGPU. I'm not including a link because it does have an in-app purchase, and I'm not sure this thread wants me advertising like that.

How to get better at rust

You are correct in that it's not an issue specific to Rust, it follows the more general rules of practice makes perfect. Do, and then do more, then push yourself into unfamiliar areas and do it all again. Also the more you learn the more you realize you don't know, you become conscious of your incompetence in an area and that presents more opportunity to expand your knowledge an skill sets. Unconscious incompetence comes first, you dont know what you dont know Conscious incompetence comes next,…

How to get better at rust

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.

Rust on Arduino

Yes, definitely, I have a fully functional environment in Termux, I have Rust analyzer, rust src, rustc, cargo etc., helix etc. I regularly build and run projects there. And I have checked what you gave, here people mostly talked about translating Rust to actual C++, not Arduino C++(those aren't the same as per I know.). And one guy asked a similar question as mine but he was replied to find it himself or the reply givers didn't know.