configbuilder_pattern_loader/feature_record_builder_ops.rs
1use crate::{FeatureMetadata, FeatureRecord, OverrideSource};
2
3/// Fluent builder operations for constructing [`FeatureRecord`] instances.
4///
5/// Implemented by [`crate::FeatureRecordBuilder`].
6pub trait FeatureRecordBuilderOps: Sized {
7 /// Create a new record builder for the named section.
8 fn new(section_name: impl Into<String>) -> Self;
9
10 /// Mark the feature as enabled or disabled.
11 fn enabled(self, v: bool) -> Self;
12
13 /// Record the source that overrode the feature state.
14 fn override_source(self, v: OverrideSource) -> Self;
15
16 /// Attach the required feature dependencies.
17 fn requires(self, v: &'static [&'static str]) -> Self;
18
19 /// Attach feature metadata to the record under construction.
20 fn metadata(self, v: FeatureMetadata) -> Self;
21
22 /// Finalise the builder and return the feature record.
23 fn build(self) -> FeatureRecord;
24}