Replace inherent setter methods with a `Set` trait
Closed this issue · 0 comments
japaric commented
The current setter methods are verbose now that enums are namespaced:
curve(.., |c| c.
color(Color::DarkViolet).
label("sin(x)").
line_type(LineType::Dash).
point_type(PointType::Circle)).
These methods could be replaced with the following trait:
trait Set<T> {
fn set(&mut self, T) -> &mut Self;
}
Now the chain would look like this:
curve(/* .. */, |c| c.
set(Color::DarkViolet).
set(Label("sin(x)")).
set(LineType::Dash).
set(PointType::Circle)).