-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
requestAsks for a guideline on a topic.Asks for a guideline on a topic.
Description
We should describe the best way to handle fallible methods on builders:
struct FooBuilder;
impl FooBuilder {
// value must be > 1 and < 128
fn max_size(self, value: usize) -> Self {
}
}Should max_size return a Result instead?
fn max_size(self, value: usize) -> Result<Self>Or should we introduce a newtype that captures the constraints:
fn max_size(self, value: FooSize) -> SelfOr should the max_size API accept any value, and just have the final build() method return a Result?
Metadata
Metadata
Assignees
Labels
requestAsks for a guideline on a topic.Asks for a guideline on a topic.