simplelog.rs
simplelog.rs copied to clipboard
[Suggestion] Make `ConfigBuilder` return itself
trafficstars
There's a thing in Rust called builder pattern which is super convinient to build a struct in-place, ConfigBuilder, however, doesn't do that, it instead needs a mutable reference, can you add methods to construct ConfigBuilder in-place? I also think that reading ConfigBuilder docs is a bit of a pain when every option starts with set_, it makes it harder to read.
ConfigBuilder's functions should return self, this will be especially convenient to use
ConfigBuilder::new().set_time_offset_to_local()
It doesn't need written two extra lines:
let mut builder = ConfigBuilder::new();
builder.set_time_offset_to_local()
... builder ...
Change ConfigBuilder return itself #103