Note: This is a PRE-ALPHA software. API breakage and bugs are expected. Please report them to the issue tracker. Once this is implemented upstream, this crate will be yanked.
GSettings Macro
Macro for easy GSettings key access
The main purpose of this is to reduce the risk of mistyping a key and
reduce boilerplate rust code. Furthermore, the summary and the default
of the value is included in the documentation of the getter and setter
function. This would be helpful if you use rust-analyzer and would
encourage documenting GSchema keys.
Schema like the following
false
Window maximized behaviour
"light"
Current theme
[]
Contains invalid words
600
Window width
Window width
"microphone"
Preferred audio source to use in recording audio
could be accessed with
use *;
;
let settings = new;
settings
.set_is_maximized
.expect;
assert!;
settings
.set_theme
.expect;
assert_eq!;
settings
.set_invalid_words
.expect;
assert_eq!;
settings
.set_window_width
.expect;
settings.window_width;
assert_eq!;
settings
.set_preferred_audio_source
.expect;
assert_eq!;
Usage
gsettings-macro = "0.1.0"
Known issues
- Failing to compile on unknown variants
- Maybe skip generating them
- Not updating when the gschema file is modified
- Use hacks like
include_str!
- Use hacks like
Todo list
- Usage documentation
- Add enum and flags support
- Add other common types support (
a{ss}, etc.)