pub struct ReloadableConfig<T> {
pub inner: T,
pub version: u64,
pub updated_at: i64,
pub source: ConfigSource,
}Expand description
Wraps any config T with version tracking and provenance metadata.
Fields§
§inner: TThe actual configuration value.
version: u64Monotonically increasing version number. Starts at 1.
updated_at: i64Unix timestamp (seconds) of the last update.
source: ConfigSourceWhere this configuration version came from.
Implementations§
Source§impl<T: Clone + Serialize> ReloadableConfig<T>
impl<T: Clone + Serialize> ReloadableConfig<T>
Sourcepub fn with_source(inner: T, source: ConfigSource) -> Self
pub fn with_source(inner: T, source: ConfigSource) -> Self
Create a new ReloadableConfig at version 1 with an explicit source.
Sourcepub fn update(&mut self, inner: T) -> u64
pub fn update(&mut self, inner: T) -> u64
Replace the inner config, increment the version, and return the new version.
Sourcepub fn update_with_source(&mut self, inner: T, source: ConfigSource) -> u64
pub fn update_with_source(&mut self, inner: T, source: ConfigSource) -> u64
Replace the inner config with an explicit source, increment the version, and return the new version.
Trait Implementations§
Source§impl<T: Clone> Clone for ReloadableConfig<T>
impl<T: Clone> Clone for ReloadableConfig<T>
Source§fn clone(&self) -> ReloadableConfig<T>
fn clone(&self) -> ReloadableConfig<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for ReloadableConfig<T>
impl<T: Debug> Debug for ReloadableConfig<T>
Source§impl<'de, T> Deserialize<'de> for ReloadableConfig<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ReloadableConfig<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for ReloadableConfig<T>where
T: Freeze,
impl<T> RefUnwindSafe for ReloadableConfig<T>where
T: RefUnwindSafe,
impl<T> Send for ReloadableConfig<T>where
T: Send,
impl<T> Sync for ReloadableConfig<T>where
T: Sync,
impl<T> Unpin for ReloadableConfig<T>where
T: Unpin,
impl<T> UnsafeUnpin for ReloadableConfig<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ReloadableConfig<T>where
T: UnwindSafe,
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