pub struct ReloadHandle<T> { /* private fields */ }
Expand description
A handle to reload a logger inside a ReloadLog
.
Implementations§
Source§impl<T> ReloadHandle<T>
impl<T> ReloadHandle<T>
Sourcepub fn replace(&self, logger: T) -> Result<(), ReloadError>
pub fn replace(&self, logger: T) -> Result<(), ReloadError>
Replace the inner logger.
This replaces the inner logger of the referenced ReloadLog
with the
given logger
, and clears any existing poison from the lock for the
inner logger.
§Errors
Return ReloadError::Gone
if the logger referenced by this reload
handle was dropped, and can no longer be reloaded.
Sourcepub fn modify<F>(&self, f: F) -> Result<(), ReloadError>
pub fn modify<F>(&self, f: F) -> Result<(), ReloadError>
Modify the inner logger.
Call the given function with a mutable reference to the logger. Note that
a lock is held while invoking f
, so no log messages will be processed
until f
returns.
If f
panics this lock gets poisoned which effectively disables the logger.
§Errors
Return ReloadError::Gone
if the logger referenced by this reload
handle was dropped, and can no longer be reloaded.
Return ReloadError::Poisoned
if the reload lock is poisoned.
Trait Implementations§
Source§impl<T: Clone> Clone for ReloadHandle<T>
impl<T: Clone> Clone for ReloadHandle<T>
Source§fn clone(&self) -> ReloadHandle<T>
fn clone(&self) -> ReloadHandle<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more