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 dispatch_deferred_from( &mut self, snapshot: &mut Self, scope: &ScopeSelector, hook: HookName, ) -> Vec<HookDispatch>

Dispatches against a pre-mutation snapshot and commits only the resulting one-shot consumption to this live store.

Reusing the same snapshot for an ordered event batch preserves normal fallback semantics and prevents a global one-shot from being copied to more than one deferred event.

Source§

impl HookStore

Source

pub fn set_with_identity( &mut self, scope: HookScopeIdentity, hook: HookName, command: String, lifecycle: HookLifecycle, options: HookSetOptions, ) -> u32

Registers or mutates a hook at a stable, already-resolved scope.

Source

pub fn unset_with_identity( &mut self, scope: &HookScopeIdentity, hook: HookName, index: Option<u32>, )

Removes a hook, or one indexed element, from a stable scope.

Source

pub fn bindings_view_with_identity( &self, scope: &HookScopeIdentity, hook: Option<HookName>, ) -> Vec<HookBindingView>

Returns explicit bindings stored at a stable scope.

Source

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

Resolves and consumes a hook using stable window and pane identities.

Source

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

Dispatches through stable identity storage while retaining compatibility with callers that populated the legacy slot-keyed API directly.

Source

pub fn dispatch_deferred_with_identity( &mut self, snapshot: &mut Self, scope: &HookScopeIdentity, hook: HookName, ) -> Vec<HookDispatch>

Dispatches from a pre-mutation snapshot and commits one-shot consumption to the live identity-keyed store.

Source

pub fn dispatch_deferred_with_identity_or_scope( &mut self, snapshot: &mut Self, identity: &HookScopeIdentity, scope: &ScopeSelector, hook: HookName, ) -> Vec<HookDispatch>

Deferred counterpart of Self::dispatch_with_identity_or_scope.

Source

pub fn retain_identities( &mut self, window_ids: &HashSet<WindowId>, pane_ids: &HashSet<PaneId>, )

Drops identity-keyed bindings whose owning objects no longer exist.

Source

pub fn replace_identity_aliases( &mut self, window_aliases: HashMap<WindowTarget, WindowId>, pane_aliases: HashMap<PaneTarget, (WindowId, PaneId)>, )

Atomically replaces slot aliases used by the compatibility API and purges bindings for identities that are no longer live.

Source

pub fn window_command_by_id( &self, window_id: WindowId, hook: HookName, ) -> Option<&str>

Returns the first exact identity-keyed window command.

Source

pub fn pane_command_by_id( &self, pane_id: PaneId, hook: HookName, ) -> Option<&str>

Returns the first exact identity-keyed pane command.

Source§

impl HookStore

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 swap_window_hooks( &mut self, source: &WindowTarget, target: &WindowTarget, )

Swaps window and pane hooks between two winlink slots.

Source

pub fn move_window_hooks( &mut self, source: &WindowTarget, target: &WindowTarget, )

Moves window and pane hooks from one winlink slot to another.

Source

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

Removes all hooks owned by the given pane.

Source

pub fn remap_session_window_indices( &mut self, session_name: &SessionName, index_map: &BTreeMap<u32, u32>, ) -> Result<(), RmuxError>

Rekeys window and pane hooks after a session window reindex.

Source

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

Rekeys all hooks owned by the given session.

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.

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 Eq for HookStore

Source§

impl PartialEq for HookStore

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
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.