Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sys::furi::Error type for kernel errors #186

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Add sys::furi::Error type for kernel errors #186

merged 1 commit into from
Nov 6, 2024

Conversation

dcoles
Copy link
Collaborator

@dcoles dcoles commented Oct 31, 2024

This is an updated attempt at improving the ergonomics around working with FuriStatus. Rather than trying to use sys::furi::Status as a pseudo-Error/Result type, use a dedicated Error enum.

In a future PR I'm going to change how the bindings for enum FuriStatus to a newtype rather than integer constant. This will remove the need for a seperate sys::furi::Status type and the associated hoops required to turn that into a Result type. Being an alias for i32 limits what traits or functions can be implemented on the type.

@dcoles dcoles requested review from str4d and JarvisCraft October 31, 2024 06:55
@dcoles
Copy link
Collaborator Author

dcoles commented Oct 31, 2024

Follow-up to #183.

Copy link
Contributor

@JarvisCraft JarvisCraft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

Adding a small non-blocking note, just in case

crates/flipperzero/src/furi/message_queue.rs Outdated Show resolved Hide resolved
This is an updated attempt at improving the ergonomics around working
with `FuriStatus`. Rather than trying to use `sys::furi::Status` as a
pseudo-`Error`/`Result` type, use a dedicated `Error` enum.

In a future PR I'm going to change how the bindings for `enum FuriStatus`
to a newtype rather than integer constant. This will remove the need
for a seperate `sys::furi::Status` type and the associated hoops required
to turn that into a `Result` type. Being an alias for `i32` limits
what traits or functions can be implemented on the type.
@dcoles dcoles merged commit b8334f2 into main Nov 6, 2024
9 checks passed
@dcoles dcoles deleted the furi-error branch November 6, 2024 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants