Skip to main content

SettingsWatcher

Struct SettingsWatcher 

Source
pub struct SettingsWatcher { /* private fields */ }
Expand description

Active directory watcher over one or more settings directories. One per TeksiloAppBuilder::run invocation (when a settings bundle with watching enabled is configured).

Owns the notify::RecommendedWatcher background thread for its whole lifetime; dropping the SettingsWatcher stops the watcher and cleans up. Kept alive by the caller for as long as live reload is wanted — teksilo-app stores it on its window-loop handler, exactly like teksilo-i18n’s FtlFileWatcher.

Implementations§

Source§

impl SettingsWatcher

Source

pub fn new(dirs: Vec<PathBuf>, sink: SettingsReloadSink) -> Result<Self, Error>

Build a watcher over dirs (deduplicated by canonical path, so passing the same directory twice — e.g. AppPaths::for_testing, whose config_dir() and data_dir() are the same tempdir — never double-watches or double-fires) and a sink callback.

A directory that does not exist (or can’t be canonicalized for any other reason) is logged and skipped — not fatal — since a freshly-installed app may not have created its data directory yet when this is called. As long as at least the config directory exists (which AppPaths implies by the time SettingsBundle has successfully opened anything in it), watching still works for the files that matter.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.