pub struct HookStore { /* private fields */ }Expand description
In-memory storage for tmux-style hook arrays.
Implementations§
Source§impl HookStore
impl HookStore
Sourcepub fn dispatch_deferred_from(
&mut self,
snapshot: &mut Self,
scope: &ScopeSelector,
hook: HookName,
) -> Vec<HookDispatch>
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
impl HookStore
Sourcepub fn set_with_identity(
&mut self,
scope: HookScopeIdentity,
hook: HookName,
command: String,
lifecycle: HookLifecycle,
options: HookSetOptions,
) -> u32
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.
Sourcepub fn unset_with_identity(
&mut self,
scope: &HookScopeIdentity,
hook: HookName,
index: Option<u32>,
)
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.
Sourcepub fn bindings_view_with_identity(
&self,
scope: &HookScopeIdentity,
hook: Option<HookName>,
) -> Vec<HookBindingView>
pub fn bindings_view_with_identity( &self, scope: &HookScopeIdentity, hook: Option<HookName>, ) -> Vec<HookBindingView>
Returns explicit bindings stored at a stable scope.
Sourcepub fn dispatch_with_identity(
&mut self,
scope: &HookScopeIdentity,
hook: HookName,
) -> Vec<HookDispatch>
pub fn dispatch_with_identity( &mut self, scope: &HookScopeIdentity, hook: HookName, ) -> Vec<HookDispatch>
Resolves and consumes a hook using stable window and pane identities.
Sourcepub fn dispatch_with_identity_or_scope(
&mut self,
identity: &HookScopeIdentity,
scope: &ScopeSelector,
hook: HookName,
) -> Vec<HookDispatch>
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.
Sourcepub fn dispatch_deferred_with_identity(
&mut self,
snapshot: &mut Self,
scope: &HookScopeIdentity,
hook: HookName,
) -> Vec<HookDispatch>
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.
Sourcepub fn dispatch_deferred_with_identity_or_scope(
&mut self,
snapshot: &mut Self,
identity: &HookScopeIdentity,
scope: &ScopeSelector,
hook: HookName,
) -> Vec<HookDispatch>
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.
Sourcepub fn retain_identities(
&mut self,
window_ids: &HashSet<WindowId>,
pane_ids: &HashSet<PaneId>,
)
pub fn retain_identities( &mut self, window_ids: &HashSet<WindowId>, pane_ids: &HashSet<PaneId>, )
Drops identity-keyed bindings whose owning objects no longer exist.
Sourcepub fn replace_identity_aliases(
&mut self,
window_aliases: HashMap<WindowTarget, WindowId>,
pane_aliases: HashMap<PaneTarget, (WindowId, PaneId)>,
)
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§impl HookStore
impl HookStore
Sourcepub fn remove_session(&mut self, session_name: &SessionName) -> bool
pub fn remove_session(&mut self, session_name: &SessionName) -> bool
Removes all hooks owned by the given session.
Sourcepub fn remove_window(&mut self, target: &WindowTarget) -> bool
pub fn remove_window(&mut self, target: &WindowTarget) -> bool
Removes all hooks owned by the given window and its panes.
Sourcepub fn swap_window_hooks(
&mut self,
source: &WindowTarget,
target: &WindowTarget,
)
pub fn swap_window_hooks( &mut self, source: &WindowTarget, target: &WindowTarget, )
Swaps window and pane hooks between two winlink slots.
Sourcepub fn move_window_hooks(
&mut self,
source: &WindowTarget,
target: &WindowTarget,
)
pub fn move_window_hooks( &mut self, source: &WindowTarget, target: &WindowTarget, )
Moves window and pane hooks from one winlink slot to another.
Sourcepub fn remove_pane(&mut self, target: &PaneTarget) -> bool
pub fn remove_pane(&mut self, target: &PaneTarget) -> bool
Removes all hooks owned by the given pane.
Sourcepub fn remap_session_window_indices(
&mut self,
session_name: &SessionName,
index_map: &BTreeMap<u32, u32>,
) -> Result<(), RmuxError>
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.
Sourcepub fn rename_session(
&mut self,
session_name: &SessionName,
new_name: SessionName,
) -> Result<(), RmuxError>
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
impl HookStore
Sourcepub fn set(
&mut self,
scope: ScopeSelector,
hook: HookName,
command: String,
lifecycle: HookLifecycle,
) -> Result<u32, RmuxError>
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.
Sourcepub fn set_with_options(
&mut self,
scope: ScopeSelector,
hook: HookName,
command: String,
lifecycle: HookLifecycle,
options: HookSetOptions,
) -> Result<u32, RmuxError>
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.
Sourcepub fn unset(
&mut self,
scope: ScopeSelector,
hook: HookName,
index: Option<u32>,
) -> Result<(), RmuxError>
pub fn unset( &mut self, scope: ScopeSelector, hook: HookName, index: Option<u32>, ) -> Result<(), RmuxError>
Removes a hook or a single indexed hook element.
Sourcepub fn global_command(&self, hook: HookName) -> Option<&str>
pub fn global_command(&self, hook: HookName) -> Option<&str>
Returns the first explicit global command for the given hook, when present.
Sourcepub fn global_command_at(&self, hook: HookName, index: u32) -> Option<&str>
pub fn global_command_at(&self, hook: HookName, index: u32) -> Option<&str>
Returns the exact global command at the given array index, when present.
Sourcepub fn global_lifecycle(&self, hook: HookName) -> Option<HookLifecycle>
pub fn global_lifecycle(&self, hook: HookName) -> Option<HookLifecycle>
Returns the first explicit global lifecycle for the given hook, when present.
Sourcepub fn global_lifecycle_at(
&self,
hook: HookName,
index: u32,
) -> Option<HookLifecycle>
pub fn global_lifecycle_at( &self, hook: HookName, index: u32, ) -> Option<HookLifecycle>
Returns the exact global lifecycle at the given array index, when present.
Sourcepub fn session_command(
&self,
session_name: &SessionName,
hook: HookName,
) -> Option<&str>
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.
Sourcepub fn session_command_at(
&self,
session_name: &SessionName,
hook: HookName,
index: u32,
) -> Option<&str>
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.
Sourcepub fn session_lifecycle(
&self,
session_name: &SessionName,
hook: HookName,
) -> Option<HookLifecycle>
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.
Sourcepub fn session_lifecycle_at(
&self,
session_name: &SessionName,
hook: HookName,
index: u32,
) -> Option<HookLifecycle>
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.
Sourcepub fn window_command(
&self,
target: &WindowTarget,
hook: HookName,
) -> Option<&str>
pub fn window_command( &self, target: &WindowTarget, hook: HookName, ) -> Option<&str>
Returns the first exact window-local command for the given hook, when present.
Sourcepub fn pane_command(&self, target: &PaneTarget, hook: HookName) -> Option<&str>
pub fn pane_command(&self, target: &PaneTarget, hook: HookName) -> Option<&str>
Returns the first exact pane-local command for the given hook, when present.
Sourcepub fn global_bindings_view(
&self,
root: HookGlobalRoot,
hook: Option<HookName>,
) -> Vec<HookBindingView>
pub fn global_bindings_view( &self, root: HookGlobalRoot, hook: Option<HookName>, ) -> Vec<HookBindingView>
Returns the explicit hook bindings for the requested global root.
Sourcepub fn session_bindings_view(
&self,
session_name: &SessionName,
hook: Option<HookName>,
) -> Vec<HookBindingView>
pub fn session_bindings_view( &self, session_name: &SessionName, hook: Option<HookName>, ) -> Vec<HookBindingView>
Returns the explicit session-local hook bindings.
Sourcepub fn window_bindings_view(
&self,
target: &WindowTarget,
hook: Option<HookName>,
) -> Vec<HookBindingView>
pub fn window_bindings_view( &self, target: &WindowTarget, hook: Option<HookName>, ) -> Vec<HookBindingView>
Returns the explicit window-local hook bindings.
Sourcepub fn pane_bindings_view(
&self,
target: &PaneTarget,
hook: Option<HookName>,
) -> Vec<HookBindingView>
pub fn pane_bindings_view( &self, target: &PaneTarget, hook: Option<HookName>, ) -> Vec<HookBindingView>
Returns the explicit pane-local hook bindings.
Sourcepub fn shipped_global_hooks(
root: HookGlobalRoot,
hook: Option<HookName>,
) -> Vec<HookName>
pub fn shipped_global_hooks( root: HookGlobalRoot, hook: Option<HookName>, ) -> Vec<HookName>
Returns the tmux-compatible hook inventory visible at the requested global root.
Sourcepub fn dispatch(
&mut self,
scope: &ScopeSelector,
hook: HookName,
) -> Vec<HookDispatch>
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.