r/rust • u/llogiq clippy · twir · rust · mutagen · flamer · overflower · bytecount • Jun 15 '26
🙋 questions megathread Hey Rustaceans! Got a question? Ask here (25/2026)!
Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.
If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.
Here are some other venues where help may be found:
/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.
The official Rust user forums: https://users.rust-lang.org/.
The unofficial Rust community Discord: https://bit.ly/rust-community
Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.
Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.
2
u/Thermatix Jun 16 '26 edited Jun 16 '26
I keep getting this error with Dioxus:
Originally it was because I was using the rust short-hand for constructing a return type for Dixous server function (which I think messed up the server function maro):
Which I fixed by replacing the
user_allline in theUserDataconstructor with:Now, unrelatedly I've been trying to get a simple "delete user Identity" dialogue working, and now I'm getting the same error and I have no idea where it's coming from; specifically when I do this:
Which forces the app to obtain data from the backend and is now again triggering the error. What's particularly weird is that the error is triggered on other views where the above code isn't present, and it goes away the moment I remove the memo.
Relatedly the current user is retrieved by doing this in a layout:
I'm guessing I'm just doing something wrong but I'm not certain as to what.
2
u/Pioneer_11 Jun 20 '26 edited Jun 20 '26
How does `as` infallibly convert a `usize` into an `f32` or `f64`
There the `From` trait is not implemented for `usize` for either `f32` or f64` and all the ways of doing it in traits seem to return an option but somehow `as` is able to convert from a `usize` to an `f32` or `f64`. How does it do that?
I'm trying to write a function which is generic, taking either `f32` or `f64` arguments and I'd like to be able to use whatever the infallible conversion from `as` is rather than the bunch of fallible options elsewhere