Struct log_reload::ReloadHandle
source · 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
.
sourcepub fn modify<F>(&self, f: F) -> Result<(), ReloadError>where
F: FnOnce(&mut T),
pub fn modify<F>(&self, f: F) -> Result<(), ReloadError>where F: FnOnce(&mut T),
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.
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>
Returns a copy 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 moreAuto Trait Implementations§
impl<T> RefUnwindSafe for ReloadHandle<T>
impl<T> Send for ReloadHandle<T>where T: Send + Sync,
impl<T> Sync for ReloadHandle<T>where T: Send + Sync,
impl<T> Unpin for ReloadHandle<T>
impl<T> UnwindSafe for ReloadHandle<T>
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