We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With #21 we want to convert all the builder type's generic parameters to a single tuple of types. Here we want to add traits for it.
Say we have:
#[derive(TypedStruct)] pub struct Foo { pub bar: u32, }
Our builder type will be (omitting the phantom field):
pub struct FooBuilder<F> { fields: F, }
To allow extending the builder type in a forward-compatible way, we want to add the following traits:
trait FooBuilderWithBar { fn get(&self) -> u32; } trait FooBuilderWithoutBar { type With: FooBuilderWithBar; fn set(self, bar: u32) -> Self::With; }
These traits will operate on F, not on FooBuilder<F>, and allow extending FooBuilder like so:
F
FooBuilder<F>
FooBuilder
impl<F: FooBuilderWithoutBar> FooBuilder<F> { pub fn bar_as_42(self) -> <F as FooBuilderWithoutBar>::With { Foo { fields: FooBuilderWithoutBar::set(self, 42), } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With #21 we want to convert all the builder type's generic parameters to a single tuple of types. Here we want to add traits for it.
Say we have:
Our builder type will be (omitting the phantom field):
To allow extending the builder type in a forward-compatible way, we want to add the following traits:
These traits will operate on
F
, not onFooBuilder<F>
, and allow extendingFooBuilder
like so:The text was updated successfully, but these errors were encountered: