pub struct ConfigSet {
pub(crate) configs: BTreeMap<String, ConfigEntry>,
}
Expand description
An set of Configs with values that may or may not be independent of other ConfigSets.
When constructing a ConfigSet from scratch with ConfigSet::default followed by ConfigSet::add, the values added to the ConfigSet will be independent of the values in all other ConfigSets.
When constructing a ConfigSet by cloning an existing ConfigSet, any values cloned from the original ConfigSet will be shared with the original ConfigSet. Updates to these values in one ConfigSet will be seen in the other ConfigSet, and vice versa. Any value added to the new ConfigSet via ConfigSet::add will be independent of values in the original ConfigSet, unless the new ConfigSet is later cloned.
Fields§
§configs: BTreeMap<String, ConfigEntry>
Implementations§
source§impl ConfigSet
impl ConfigSet
sourcepub fn add<D: ConfigDefault>(self, config: &Config<D>) -> Self
pub fn add<D: ConfigDefault>(self, config: &Config<D>) -> Self
Adds the given config to this set.
Names are required to be unique within a set, but each set is entirely
independent. The same Config
may be registered to multiple
ConfigSet
s and thus have independent values (e.g. imagine a unit
test executing concurrently in the same process).
Panics if a config with the same name has been previously registered to this set.
sourcepub fn entries(&self) -> impl Iterator<Item = &ConfigEntry>
pub fn entries(&self) -> impl Iterator<Item = &ConfigEntry>
Returns the configs currently registered to this set.
sourcepub fn entry(&self, name: &str) -> Option<&ConfigEntry>
pub fn entry(&self, name: &str) -> Option<&ConfigEntry>
Returns the config with name
registered to this set, if one exists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigSet
impl RefUnwindSafe for ConfigSet
impl Send for ConfigSet
impl Sync for ConfigSet
impl Unpin for ConfigSet
impl UnwindSafe for ConfigSet
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.