RustEmbedNotifyAssets

Struct RustEmbedNotifyAssets 

Source
pub struct RustEmbedNotifyAssets<T: RustEmbed> { /* private fields */ }
Expand description

A wrapper for rust_embed::RustEmbed that supports notifications when files have changed on the file system. A wrapper is required to provide base_dir as this is unavailable in the type derived by the rust_embed::RustEmbed macro.

⚠️ This type requires the following crate features to be activated: autoreload.

Implementations§

Source§

impl<T: RustEmbed> RustEmbedNotifyAssets<T>

Source

pub fn new(base_dir: impl Into<PathBuf>) -> Self

Construct a new RustEmbedNotifyAssets.

Trait Implementations§

Source§

impl<T: Debug + RustEmbed> Debug for RustEmbedNotifyAssets<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> I18nAssets for RustEmbedNotifyAssets<T>
where T: RustEmbed,

Available on crate feature autoreload only.
Source§

fn get_files(&self, file_path: &str) -> Vec<Cow<'_, [u8]>>

Get localization asset files that correspond to the specified file_path. Returns an empty Vec if the asset does not exist, or unable to obtain the asset due to a non-critical error.
Source§

fn filenames_iter(&self) -> Box<dyn Iterator<Item = String>>

Get an iterator over the file paths of the localization assets. There may be duplicates where multiple files exist for the same file path.
Source§

fn subscribe_changed( &self, changed: Arc<dyn Fn() + Send + Sync + 'static>, ) -> Result<Box<dyn Watcher + Send + Sync + 'static>, I18nEmbedError>

A method to allow users of this trait to subscribe to change events, and reload assets when they have changed. The subscription will be cancelled when the returned Watcher is dropped. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RustEmbedNotifyAssets<T>

§

impl<T> RefUnwindSafe for RustEmbedNotifyAssets<T>
where T: RefUnwindSafe,

§

impl<T> Send for RustEmbedNotifyAssets<T>
where T: Send,

§

impl<T> Sync for RustEmbedNotifyAssets<T>
where T: Sync,

§

impl<T> Unpin for RustEmbedNotifyAssets<T>
where T: Unpin,

§

impl<T> UnwindSafe for RustEmbedNotifyAssets<T>
where T: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.