-
Notifications
You must be signed in to change notification settings - Fork 52
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
How to make Builder implement Deserialize
?
#68
Comments
I'm not sure what you want to do even makes sense. When you think about deserializing a builder, you probably think about something like this: #[derive(TypedBuilder)]
struct Foo {
#[builder(default = 1)]
bar: i32,
#[builder(default = 2)]
baz: i32,
}
assert_eq!(
Foo::builder(),
deserialize::<FooBuilder>(r#"{}"#),
);
assert_eq!(
Foo::builder().bar(3),
deserialize::<FooBuilder>(r#"{"bar": 3}"#),
);
assert_eq!(
Foo::builder().baz(4),
deserialize::<FooBuilder>(r#"{"baz": 4}"#),
);
assert_eq!(
Foo::builder().bar(3).baz(4),
deserialize::<FooBuilder>(r#"{"bar": 3, "baz": 4}"#),
); The problem is that these are four distinct types! |
Use case:
On client side I want to load config from a file that ovewrites certain fields. With |
I'm interested in this feature for the same reason as above |
Hi!
I want to use the builder together with
config-rs
to use config from a file as input for the builder. For that the builder struct must supportDeserialize
. How can I achieve that?Thanks
The text was updated successfully, but these errors were encountered: