Skip to main content

Hook

Enum Hook 

Source
pub enum Hook {
Show 13 variants OnNavigate { from: PathBuf, to: PathBuf, }, OnScanStart { path: PathBuf, }, OnScanComplete { path: PathBuf, total_files: u64, total_dirs: u64, total_size: u64, }, OnScanError { path: PathBuf, error: String, }, OnDeleteStart { items: Vec<PathBuf>, use_trash: bool, }, OnDeleteComplete { deleted: usize, failed: usize, bytes_freed: u64, }, OnCopyComplete { succeeded: usize, failed: usize, bytes_copied: u64, }, OnMoveComplete { succeeded: usize, failed: usize, }, OnRenameComplete { source: PathBuf, new_path: PathBuf, }, OnDuplicatesFound { group_count: usize, wasted_bytes: u64, }, OnAgeAnalysisComplete { stale_dirs: usize, files: u64, average_age_secs: u64, }, OnStartup, OnShutdown,
}
Expand description

Events that plugins can hook into.

Variants§

§

OnNavigate

The explorer moved to another directory.

Fields

§from: PathBuf

Previous directory path.

§to: PathBuf

New directory path.

§

OnScanStart

A full scan started.

Fields

§path: PathBuf

Root path being scanned.

§

OnScanComplete

A full scan finished.

Fields

§path: PathBuf

Root path that was scanned.

§total_files: u64

Total files found.

§total_dirs: u64

Total directories found.

§total_size: u64

Total size in bytes.

§

OnScanError

A full scan failed.

Fields

§path: PathBuf

Root path that failed.

§error: String

Error message.

§

OnDeleteStart

A delete is about to start. Awaited; a plugin can veto it.

Fields

§items: Vec<PathBuf>

Items to be deleted.

§use_trash: bool

Whether using trash (recoverable).

§

OnDeleteComplete

A delete finished.

Fields

§deleted: usize

Number of items successfully deleted.

§failed: usize

Number of items that failed to delete.

§bytes_freed: u64

Total bytes freed.

§

OnCopyComplete

A copy finished.

Fields

§succeeded: usize

Number of items successfully copied.

§failed: usize

Number of items that failed.

§bytes_copied: u64

Total bytes copied.

§

OnMoveComplete

A move finished.

Fields

§succeeded: usize

Number of items successfully moved.

§failed: usize

Number of items that failed.

§

OnRenameComplete

A rename finished.

Fields

§source: PathBuf

Original path.

§new_path: PathBuf

New path after rename.

§

OnDuplicatesFound

Duplicate analysis finished.

Fields

§group_count: usize

Number of duplicate groups found.

§wasted_bytes: u64

Total wasted space in bytes.

§

OnAgeAnalysisComplete

Age analysis finished.

Fields

§stale_dirs: usize

Number of stale directories found.

§files: u64

Files whose ages were counted.

§average_age_secs: u64

Their average age, in seconds.

§

OnStartup

The explorer started.

§

OnShutdown

The explorer is about to quit; awaited briefly.

Implementations§

Source§

impl Hook

Source

pub fn name(&self) -> &'static str

The function a plugin defines to receive this hook.

Trait Implementations§

Source§

impl Clone for Hook

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Hook

Source§

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

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

impl<'de> Deserialize<'de> for Hook

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Hook

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Hook

§

impl RefUnwindSafe for Hook

§

impl Send for Hook

§

impl Sync for Hook

§

impl Unpin for Hook

§

impl UnsafeUnpin for Hook

§

impl UnwindSafe for Hook

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more