pub struct ReloadableConfiguration(/* private fields */);Expand description
Represents a reloadable configuration.
Implementations§
Source§impl ReloadableConfiguration
impl ReloadableConfiguration
Sourcepub fn new(builder: Builder, configuration: Configuration) -> Self
pub fn new(builder: Builder, configuration: Configuration) -> Self
Initializes a new ReloadableConfiguration.
§Arguments
builder- The builder used to reload the configurationconfig- The initial configuration
Sourcepub fn current(&self) -> Arc<Configuration>
pub fn current(&self) -> Arc<Configuration>
Gets the current configuration.
§Remarks
This method will reload the configuration if it has changed. If the reload operation fails, then the error is logged and the previous configuration is retained.
Source§impl ReloadableConfiguration
impl ReloadableConfiguration
Sourcepub fn reify<T: DeserializeOwned>(&self) -> Result<T>
Available on crate feature binder only.
pub fn reify<T: DeserializeOwned>(&self) -> Result<T>
binder only.Creates and returns a structure reified from the configuration.
Sourcepub fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
Available on crate feature binder only.
pub fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
binder only.Binds the configuration to the specified instance.
§Arguments
instance- The instance to bind the configuration to
Sourcepub fn bind_at<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
) -> Result
Available on crate feature binder only.
pub fn bind_at<T: DeserializeOwned>( &self, key: impl AsRef<str>, instance: &mut T, ) -> Result
binder only.Binds the specified configuration section to the provided instance.
§Arguments
key- The key of the configuration section to bindinstance- The instance to bind the configuration to
Trait Implementations§
Source§impl Binder for ReloadableConfiguration
Available on crate feature binder only.
impl Binder for ReloadableConfiguration
Available on crate feature
binder only.Source§fn reify<T: DeserializeOwned>(&self) -> Result<T>
fn reify<T: DeserializeOwned>(&self) -> Result<T>
Creates and returns a structure reified from the configuration.
Source§fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
Binds the configuration to the specified instance. Read more
Source§fn bind_at<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
) -> Result
fn bind_at<T: DeserializeOwned>( &self, key: impl AsRef<str>, instance: &mut T, ) -> Result
Binds the specified configuration section to the provided instance. Read more
Source§fn get_value<T: FromStr>(
&self,
key: impl AsRef<str>,
) -> Result<Option<T>, T::Err>
fn get_value<T: FromStr>( &self, key: impl AsRef<str>, ) -> Result<Option<T>, T::Err>
Gets a typed value from the configuration. Read more
Source§fn get_value_or_default<T: FromStr + Default>(
&self,
key: impl AsRef<str>,
) -> Result<T, T::Err>
fn get_value_or_default<T: FromStr + Default>( &self, key: impl AsRef<str>, ) -> Result<T, T::Err>
Gets an optional, typed value from the configuration. Read more
Source§fn reify_unchecked<T: DeserializeOwned>(&self) -> T
fn reify_unchecked<T: DeserializeOwned>(&self) -> T
Creates and returns a structure reified from the configuration. Read more
Source§fn bind_unchecked<T: DeserializeOwned>(&self, instance: &mut T)
fn bind_unchecked<T: DeserializeOwned>(&self, instance: &mut T)
Binds the configuration to the specified instance. Read more
Source§fn bind_at_unchecked<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
)
fn bind_at_unchecked<T: DeserializeOwned>( &self, key: impl AsRef<str>, instance: &mut T, )
Binds the specified configuration section to the provided instance. Read more
Source§impl Clone for ReloadableConfiguration
impl Clone for ReloadableConfiguration
Source§impl Debug for ReloadableConfiguration
impl Debug for ReloadableConfiguration
Source§impl Display for ReloadableConfiguration
impl Display for ReloadableConfiguration
Source§impl From<&ReloadableConfiguration> for Arc<Configuration>
impl From<&ReloadableConfiguration> for Arc<Configuration>
Source§fn from(rc: &ReloadableConfiguration) -> Self
fn from(rc: &ReloadableConfiguration) -> Self
Converts to this type from the input type.
Source§impl From<ReloadableConfiguration> for Arc<Configuration>
impl From<ReloadableConfiguration> for Arc<Configuration>
Source§fn from(rc: ReloadableConfiguration) -> Self
fn from(rc: ReloadableConfiguration) -> Self
Converts to this type from the input type.
Source§impl Reloadable for ReloadableConfiguration
impl Reloadable for ReloadableConfiguration
Source§fn can_reload(&self) -> bool
fn can_reload(&self) -> bool
Gets a value indicating whether the configuration can be reloaded.
Source§fn reload_token(&self) -> impl ChangeToken + 'static
fn reload_token(&self) -> impl ChangeToken + 'static
Gets a change token that will be notified when the configuration is reloaded.
Auto Trait Implementations§
impl Freeze for ReloadableConfiguration
impl !RefUnwindSafe for ReloadableConfiguration
impl Send for ReloadableConfiguration
impl Sync for ReloadableConfiguration
impl Unpin for ReloadableConfiguration
impl UnsafeUnpin for ReloadableConfiguration
impl !UnwindSafe for ReloadableConfiguration
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
Mutably borrows from an owned value. Read more