Skip to main content

HookStore

Struct HookStore 

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

In-memory storage for tmux-style hook arrays.

Implementations§

Source§

impl HookStore

Source

pub fn new() -> Self

Creates an empty hook store with no registered hooks.

Source

pub fn is_empty(&self) -> bool

Returns whether no explicit hooks are present at any scope.

Source

pub fn set( &mut self, scope: ScopeSelector, hook: HookName, command: String, lifecycle: HookLifecycle, ) -> Result<u32, RmuxError>

Registers or replaces a hook using tmux’s default index-zero semantics.

Source

pub fn set_with_options( &mut self, scope: ScopeSelector, hook: HookName, command: String, lifecycle: HookLifecycle, options: HookSetOptions, ) -> Result<u32, RmuxError>

Registers or mutates a hook using indexed tmux array semantics.

Source

pub fn unset( &mut self, scope: ScopeSelector, hook: HookName, index: Option<u32>, ) -> Result<(), RmuxError>

Removes a hook or a single indexed hook element.

Source

pub fn global_command(&self, hook: HookName) -> Option<&str>

Returns the first explicit global command for the given hook, when present.

Source

pub fn global_command_at(&self, hook: HookName, index: u32) -> Option<&str>

Returns the exact global command at the given array index, when present.

Source

pub fn global_lifecycle(&self, hook: HookName) -> Option<HookLifecycle>

Returns the first explicit global lifecycle for the given hook, when present.

Source

pub fn global_lifecycle_at( &self, hook: HookName, index: u32, ) -> Option<HookLifecycle>

Returns the exact global lifecycle at the given array index, when present.

Source

pub fn session_command( &self, session_name: &SessionName, hook: HookName, ) -> Option<&str>

Returns the first exact session-local command for the given hook, when present.

Source

pub fn session_command_at( &self, session_name: &SessionName, hook: HookName, index: u32, ) -> Option<&str>

Returns the exact session-local command at the given array index, when present.

Source

pub fn session_lifecycle( &self, session_name: &SessionName, hook: HookName, ) -> Option<HookLifecycle>

Returns the first exact session-local lifecycle for the given hook, when present.

Source

pub fn session_lifecycle_at( &self, session_name: &SessionName, hook: HookName, index: u32, ) -> Option<HookLifecycle>

Returns the exact session-local lifecycle at the given array index, when present.

Source

pub fn window_command( &self, target: &WindowTarget, hook: HookName, ) -> Option<&str>

Returns the first exact window-local command for the given hook, when present.

Source

pub fn pane_command(&self, target: &PaneTarget, hook: HookName) -> Option<&str>

Returns the first exact pane-local command for the given hook, when present.

Source

pub fn global_bindings_view( &self, root: HookGlobalRoot, hook: Option<HookName>, ) -> Vec<HookBindingView>

Returns the explicit hook bindings for the requested global root.

Source

pub fn session_bindings_view( &self, session_name: &SessionName, hook: Option<HookName>, ) -> Vec<HookBindingView>

Returns the explicit session-local hook bindings.

Source

pub fn window_bindings_view( &self, target: &WindowTarget, hook: Option<HookName>, ) -> Vec<HookBindingView>

Returns the explicit window-local hook bindings.

Source

pub fn pane_bindings_view( &self, target: &PaneTarget, hook: Option<HookName>, ) -> Vec<HookBindingView>

Returns the explicit pane-local hook bindings.

Source

pub fn shipped_global_hooks( root: HookGlobalRoot, hook: Option<HookName>, ) -> Vec<HookName>

Returns the tmux-compatible hook inventory visible at the requested global root.

Source

pub fn dispatch( &mut self, scope: &ScopeSelector, hook: HookName, ) -> Vec<HookDispatch>

Resolves a hook for the provided event scope and returns the matching command batch.

Source

pub fn remove_session(&mut self, session_name: &SessionName) -> bool

Removes all hooks owned by the given session.

Source

pub fn remove_window(&mut self, target: &WindowTarget) -> bool

Removes all hooks owned by the given window and its panes.

Source

pub fn remove_pane(&mut self, target: &PaneTarget) -> bool

Removes all hooks owned by the given pane.

Source

pub fn rename_session( &mut self, session_name: &SessionName, new_name: SessionName, ) -> Result<(), RmuxError>

Rekeys all hooks owned by the given session.

Trait Implementations§

Source§

impl Clone for HookStore

Source§

fn clone(&self) -> HookStore

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 HookStore

Source§

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

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

impl Default for HookStore

Source§

fn default() -> HookStore

Returns the “default value” for a type. Read more
Source§

impl PartialEq for HookStore

Source§

fn eq(&self, other: &HookStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for HookStore

Source§

impl StructuralPartialEq for HookStore

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> 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> 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> 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 = 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.