Replies: 3 comments 1 reply
-
Hi @Strosel, I'm glad to hear you find this crate useful. I hope that it provides a good foundation for Rust apps on the Flipper Zero. 🎉 I 100% agree that working with The reason we went with Is that too much overhead? It's hard to say. Though I've already been bitten by So for the moment I'm being conservative, because someone may really need all the memory they can get. This isn't unusual for embedded systems—the Flipper Zero doesn't support exception unwinding for similar reasons. There is already a Let me know what you think. The idea of the |
Beta Was this translation helpful? Give feedback.
-
The concern is less about the binary size and more about the runtime memory overhead ( I think (it's been a while) I used You are correct about So the options would look something like this: foo(cstr!("Hello, world!")); // returns void
foo("Hello, world!\0"); // returns `Result<(), FromBytesWithNulError>` At present I'm still learning towards keeping the type-safe API ( |
Beta Was this translation helpful? Give feedback.
-
As an alternative (and in part because various parts of the Flipper Zero SDK require interacting with this type), I've started wrapping the |
Beta Was this translation helpful? Give feedback.
-
Hello!
Firstly I'd like to thank you for creating this crate as a rust enthusiast looking forward to developing apps for my flipper zero.
I am starting this discussion thread to voice my own personal opinions and ideas on the API in this crate, and I'm fully aware that my opinion is not universal, but I thought it'd be nice to maybe have some constructive discussion on the topic.
My main point of discussion is the choice of types, mainly in the
flipperzero
crate and at the time of writingflipperzero::furi::dialog
to be specific. What is not gelling with me is the use ofCStr
throughout this module. I understand that it is necessary "further down" in the sys crate but as I understand it this crate is supposed to be somewhat higher level than the sys crate it is calling into. Therefore wouldn't it make more sense to use an at least somewhat higher-level type and then convert toCStr
internally?I tried cloning the repo and replacing
CStr
with bothstr
and[u8]
as well as changing the affected functions' return types toResult<(), FromBytesWithNulError>
to "bubble up" potential conversion errors. I personally thought this worked pretty well, as it made client-side code a little easier to both read and write. The[u8]
approach is what I think would work best as it was easier to use inside the crate compared tostr
with little to no difference client-side.I look forward to hearing your opinions on this 😄
Beta Was this translation helpful? Give feedback.
All reactions