T
To add a bit on that, 32-bit ARMv7 Linux is still alive and well (for now) and splits of 3G user and 1G kernel has been the default. This is a platform that is still hanging around and in use today, so it seems like something we should care about.
T
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…
T
That 2GB split can be extended to 3GB with a linker flag, though.
T
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…
T
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…
T
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…
T
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
T
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!
T
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.
T
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…
T
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…
T
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.
T
I haven't touched my Arduino boards in a while, but avr-hal seems like the way to go: It includes a more traditional generic HAL avr-hal-generic but also arduino-hal which makes things simpler in the same way Arduino's standard library does.
T
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.
T
steffahn: YMMV how “correct” an application of AssertUnwindSafe may be in cases of FnMut or Fn. Add + UnwindSafe + RefUnwindSafe to emphasize its meaninglessness where applicable .
T
Also, just be prepared as I am pretty new to Rust, but can easily learn and help fix. I am pretty good at Arduino C++ , so you know. Another question is how do you code your Arduino? Is there like an app on mobile for it, or do you a computer for that.
T
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.
T
In the example they do not ignore the Result.
T
rhansen: It is perfectly valid to ignore the returned closure, but ignoring the closure generates the must_use compiler warning, I think it would be surprising behavior to not require using a Result return value, so I don't recommend trying to disable it.
T
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,…
T
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…
T
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…
T
rust-analyzer only giving a single option in that case sounds like a bug/missing feature to me.
T
I wonder if you can work around this by returning your own trait that's Self: FnOnce().
T
To build on what @06chaynes said, you need to find a more significant project that is motivating to you. I suggest picking something you love or truly are interested in, rather than something you think will impress others. What are you areas of interest?
T
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.
T
I don't believe there's a way to disable must_use on a type.
T
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,…
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.
T
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.