-
Notifications
You must be signed in to change notification settings - Fork 58
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
Revised Config #776
base: main
Are you sure you want to change the base?
Revised Config #776
Conversation
Main functionality is in, mostly looking for feedback on: Config structWe okay with how the struct is set up and how each backend handles accessing it? Specifically, pay close attention to how there are two Attribute systemCan't use a custom inner attribute, they're considered unstable at the moment. Currently planning on a system like: #[diplomat::config(some.option = yes)]
struct Config;
// Modules can also have config structs:
pub mod some_other_thing;
/* some_other_thing.rs
#[diplomat::config(option.one = 42)]
struct SomeOtherConfig {}
*/
#[diplomat::bridge]
#[diplomat::config(other.options = sure)]
mod ffi {
// No configs here
} I think restricting the Merging systemFeels a little convoluted, but I'm not sure there are many better alternatives? Right now we have to convert every |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly shaped correctly, will do in depth review later
@@ -38,6 +39,9 @@ pub struct Attrs { | |||
/// not see the impl blocks. | |||
pub attrs: Vec<DiplomatBackendAttr>, | |||
|
|||
/// Backend specific configuration attributes: | |||
pub config_attrs: Vec<DiplomatBackendConfigAttr>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought: these shouldn't be allowed on random types, we should require they go on a toplevel type in lib.rs (with whatever name they get).
Yeah I think I noted this in the issue.
I would love for the override to be automatic, but I'll look closer at the code.
Tbh not a big deal to have a |
Put config language in
tool/config.rs
, and it can currently be set through aconfig.toml
file (which can be customized on the command line).Some TODOs here:
lib_name
)Fixes #772