Open Malax opened 2 years ago
Since this issue was opened:
LayerResultBuilder
/ LayerResult
were introduced (in #144)DetectResultBuilder
and BuildResultBuilder
were changed to match LayerResultBuilder
's wrapping in a Result
(in #209)LayerContentMetadata
(in #235)As of now, we have the following builder types:
DetectResultBuilder
PassDetectResultBuilder
FailDetectResultBuilder
BuildPlanBuilder
BuildResultBuilder
LayerResultBuilder
(We'll also have ProcessBuilder
once #265 merges)
We then have the following chainable methods on non-builder types:
Launch::process()
Env::insert()
LayerEnv::chainable_insert()
(which is a chainable version of LayerEnv::insert
)LayerEnvDelta::insert()
There are a few issues with the chainable methods on non-builder types:
Launch
, there is only a method for inserting into processes
, not any of the other fields on the struct.Layer
/ LayerEnv
there is a mixture of having the standard insert()
being chainable vs having a separate chainable_insert()
.How do we want to resolve these?
At this point, I'm leaning towards explicit Builder
suffixes and non-consuming builder implementations. Explicit names aid with discoverability and non-consuming builders are the "gold standard" in the Rust ecosystem. They allow our users to do chained calls and mutable values with the same API.
Some types don't provide builder-like functionality but have dedicated
*Builder
types, others have it with the normal type, some have nothing. We should ensure API consistency.