i'm looking for something like golang's fs.FS interface, but for rust. I've seen a few crates for this, such as filesystem and vfs, but nothing as flexible or generic. am i missing something?| The Rust Programming Language Forum
This is a companion discussion topic for the Async Interviews that I am discussing. As the introductory blog post clarifies, the goal of these interviews is primarily to help answer the question, "Now that async-await is stable, what should we do next?" But it's also just to have fun talking about Async I/O and Rust and exploring what the ecosystem has to offer. Collected links to the blog posts and videos: Async Interview #1: Alex and Nick talk about async I/O and WebAssembly (video) Async ...| The Rust Programming Language Forum
Methods sometimes need access to the Arc managing self. This is easy: fn f(self: Arc) (to own the reference count) or fn f(self: &Arc) (to borrow it with the possibility of owning a count later by clone()). The former has the issue that every method call consumes self so many calls need o.clone().f() which is very unergonomically and it's slower because of the forced atomic inc/dec. But the &Arc version works, so whatever. However, if I want to pass around an Arc, then...| The Rust Programming Language Forum
General discussion of The Rust Programming Language| The Rust Programming Language Forum
This is not a real problem that I have, but I was thinking on how similar functionality can be implemented in Rust. I have an application struct, which owns other subsystems, such as the Executor. I want to be able to push closures to the executor, which contain references to the application struct. Essentially I want to have my own scoped closures, similar to scoped threads in std. As in the following example. What are the safe ways to implement this? I want the App to specifically not be wr...| The Rust Programming Language Forum
Hi, Is it possible by using serde/serde_json to deserialize struct that has raw ptr as a member? The deserialization should assign null to that member? Thank you| The Rust Programming Language Forum
I want to emphasize here that an uninhabited type isn't quite a zero sized type; it's generally fine to treat them as such, but ideally size_of() would be returning that it has no size at all, not even a size of 0. There's a related situation with dynamically sized types like dyn Foo and [Bar] (without a wrapping reference) - it's not documented, but IIRC size_of() panics for those as 0 is not a reasonable fallback? Logically, it should probably return an enum itself!| The Rust Programming Language Forum
I made a library that's used by a larger application. The application calls some function of my library, which is blocking. Currently, you cannot interrupt the application while my library's code is running. I want to be able to terminate my library with Ctrl+C, which should: Run some cleanup actions, including killing a process, starting a process, and writing to files. This does not need to be interruptible; e.g. a second Ctrl+C does not need to do anything. Return an Err(Error::Interrupted...| The Rust Programming Language Forum
General discussion of The Rust Programming Language| The Rust Programming Language Forum
General discussion of The Rust Programming Language| The Rust Programming Language Forum
General discussion of The Rust Programming Language| The Rust Programming Language Forum
How can I correctly declare type inside declarative macro by separating type's name itself and it's generics ? Consider this example: struct RectangleA; struct RectangleB; I want to separate type declaration (and possibly it's genercics) between few macroses to match on different parameters. I see it like this: macro_rules! get_type { (false) => { RectangleA } (true) => { RectangleB ...| The Rust Programming Language Forum
Why this works and Why it won't work| The Rust Programming Language Forum
The current docs.rust-lang.org has two things I'd like to be changed: The theme-selection applies to std but not to the main url (that above) which is always bright white. (I'm aware I could just use stylus and write own style, but that's not the point.) Just as we can change the theme I'd like to have a cookie that defaults to one of stable / beta / nightly and it redirects to such url when possible. Would these requests make sense, or is it too much of an unimportant / irrelevant / not usef...| The Rust Programming Language Forum
General discussion of The Rust Programming Language| The Rust Programming Language Forum
What do you think about the coming change of std::env::set_var() becoming unsafe? I'm using this in tests to set the log levels to a predefined value. Not sure what has been the thoughts to do this change. Then you have also to mark any File read unsafe, because some other thread or process could change the file content while reading/writing the file.| The Rust Programming Language Forum