flipperzero-rs / flipperzero

Rust on the Flipper Zero
MIT License
499 stars 32 forks source link

feat: make `DialogFileBrowserOptions::new()` use native initialization function #92

Closed JarvisCraft closed 2 weeks ago

JarvisCraft commented 1 year ago

Description

In #80 safe bindings for dialogs app file browser were added by @mogenson. At this moment, the native initialization function was unsound since it forgot to initialize one of the fields so we decided to perform initialization on Rust side.

Now that this issues is fixed in flipperdevices/flipperzero-firmware#2756 with the future guarantee to always initialize all fields we can (and should) migrate to this approach which is better for us from backwards compatibility standpoint since we will no longer have to reflect the changes to this structure on our side for sake of safety.

Requirements

Notes

I've also added a c_str macro which has magically become const-friendly with the recent stabilization of from_bytes_with_nul which will land to stable soon (at least, by the time we are ready to become stable-friendly; anyways, it is behind a macro so there is no explicit dependency on unstable toolchain as for now).

str4d commented 10 months ago

Build is failing.

JarvisCraft commented 10 months ago

Build is failing.

Yup, I am going to fix that, but now that cstr-literals are stabilized in 1.76, I may rework this PR to omit the redundant dependency.

JarvisCraft commented 10 months ago

[!IMPORTANT]

Since this PR effectively depends on #120, Clippy should be fixed by the latter.