pub struct CONFIG;Expand description
Represents the app main config.
Config sources must be loaded using CONFIG.load, otherwise the config only lives for the
duration of the app instance.
§Provider
This service is provided by the ConfigManager extension, it will panic if used in an app not extended.
Implementations§
Source§impl CONFIG
impl CONFIG
Sourcepub fn load(&self, source: impl AnyConfig)
pub fn load(&self, source: impl AnyConfig)
Replace the config source.
Variables and bindings survive source replacement, updating to the new value or setting the new source if the key is not present in the new source.
Sourcepub fn status(&self) -> Var<ConfigStatus>
pub fn status(&self) -> Var<ConfigStatus>
Gets a read-only variable that represents the IO status of the config.
Sourcepub fn get<T>(&self, key: impl Into<Txt>, default: T) -> Var<T>where
T: ConfigValue,
pub fn get<T>(&self, key: impl Into<Txt>, default: T) -> Var<T>where
T: ConfigValue,
Gets a variable that is bound to the config key.
The same variable is returned for multiple requests of the same key. If the loaded config is not read-only the returned variable can be set to update the config source.
The default value is used if the key is not found in the config, the default value
is not inserted in the config, the key is inserted or replaced only when the returned variable updates.
Trait Implementations§
Source§impl AnyConfig for CONFIG
impl AnyConfig for CONFIG
Source§fn get_raw(
&mut self,
key: Txt,
default: RawConfigValue,
insert: bool,
) -> Var<RawConfigValue>
fn get_raw( &mut self, key: Txt, default: RawConfigValue, insert: bool, ) -> Var<RawConfigValue>
key. Read moreSource§fn contains_key(&mut self, key: Txt) -> Var<bool>
fn contains_key(&mut self, key: Txt) -> Var<bool>
key is in the backing storage.Source§fn status(&self) -> Var<ConfigStatus>
fn status(&self) -> Var<ConfigStatus>
Source§fn low_memory(&mut self)
fn low_memory(&mut self)
Auto Trait Implementations§
impl Freeze for CONFIG
impl RefUnwindSafe for CONFIG
impl Send for CONFIG
impl Sync for CONFIG
impl Unpin for CONFIG
impl UnwindSafe for CONFIG
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more