Skip to main content

ReloadHandle

Trait ReloadHandle 

Source
pub trait ReloadHandle<L> {
    // Required methods
    fn current(&self) -> Option<L>;
    fn reload(&self, new_value: L) -> Result<(), Error>;
}
Expand description

We need to store a reload::Handle value, but can’t name it’s type explicitly because the S type parameter depends on the subscriber’s previous layers. In our case, this includes unnameable ‘impl Trait’ types.

This is fixed1 in the unreleased tracing-subscriber from the master branch, which removes the S parameter. Unfortunately can’t use it without pulling in a version of tracing that’s incompatible with the rest of our deps.

To work around this, we define an trait without the S parameter that forwards to the reload::Handle::reload method, and then store the handle as a trait object.

Required Methods§

Source

fn current(&self) -> Option<L>

Source

fn reload(&self, new_value: L) -> Result<(), Error>

Implementations on Foreign Types§

Source§

impl<L: Clone, S> ReloadHandle<L> for Handle<L, S>

Source§

fn current(&self) -> Option<L>

Source§

fn reload(&self, new_value: L) -> Result<(), Error>

Implementors§