-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(axevent)!: Take ownership of returned value in
get_string
(#149)
`crates/axevent/src/flex.rs`: - Use custom type instead of `GString` or `GStringPtr` because `axevent` supports both keys and values that are not valid UTF-8 and, though it seems unlikely that users will want to consume or produce such events, supporting it is easy. The biggest drawback is reduced ergonomics since users have to convert to normal strings themselves. - Don't use `mbox` to avoid adding another crate to the public API. Furthermore `mbox::MString` requires the string to be valid UTF-8, just like `glib::GString` so we would have to use one of the other types, and it is not clear to me if or how that would lead to a better API. - Add `debug_assert!(!ptr.is_null())` to make it more likely that violations of the preconditions are caught without incurring a cost at runtime in production. Since this API is internal to the crate, I think the value is low, but so is the cost so might as well have it.
- Loading branch information
1 parent
40f7792
commit d62037c
Showing
4 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters