Skip to main content

SessionStore

Struct SessionStore 

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

In-memory storage for all sessions owned by the server.

Implementations§

Source§

impl SessionStore

Source

pub fn new() -> Self

Creates an empty session store.

Source

pub fn len(&self) -> usize

Returns the number of sessions currently present.

Source

pub fn is_empty(&self) -> bool

Returns whether the store contains no sessions.

Source

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

Returns whether the addressed session exists.

Source

pub fn session(&self, session_name: &SessionName) -> Option<&Session>

Returns an immutable reference to the named session.

Source

pub fn session_by_id( &self, session_id: impl Into<SessionId>, ) -> Option<&Session>

Returns the session with the store-assigned $N identity.

Source

pub fn iter(&self) -> impl Iterator<Item = (&SessionName, &Session)>

Returns an iterator over all sessions in the store.

Source

pub fn session_group_name( &self, session_name: &SessionName, ) -> Option<&SessionName>

Returns the stable session group name for the addressed session.

Source

pub fn runtime_owner(&self, session_name: &SessionName) -> Option<SessionName>

Returns the runtime-owning session for the addressed session.

Source

pub fn runtime_owner_transfer_target( &self, session_name: &SessionName, ) -> Option<SessionName>

Returns the next runtime-owning session when the current runtime owner is removed.

Source

pub fn session_group_members( &self, session_name: &SessionName, ) -> Vec<SessionName>

Returns the grouped peer sessions for the addressed session in stable name order.

Source

pub fn session_group_size(&self, session_name: &SessionName) -> usize

Returns the number of sessions sharing the addressed session’s group.

Source

pub fn contains_group(&self, group_name: &SessionName) -> bool

Returns whether a named session group exists.

Source

pub fn sessions_in_group(&self, group_name: &SessionName) -> Vec<SessionName>

Returns grouped sessions for the named group in stable name order.

Source

pub fn create_session( &mut self, session_name: SessionName, size: TerminalSize, ) -> Result<(), RmuxError>

Creates a session or returns DuplicateSession when the name exists.

Source

pub fn create_session_with_base_index( &mut self, session_name: SessionName, size: TerminalSize, base_index: u32, ) -> Result<(), RmuxError>

Creates a session using the requested first window index.

Source

pub fn create_auto_named_session_with_base_index( &mut self, size: TerminalSize, base_index: u32, ) -> Result<SessionName, RmuxError>

Creates an auto-named tmux-compatible session using the next global session id for both the $id and the visible session name.

Source

pub fn create_grouped_session_with_base_index( &mut self, session_name: SessionName, size: TerminalSize, base_index: u32, group_target: SessionName, ) -> Result<GroupedSessionCreation, RmuxError>

Creates a session in an existing or newly-declared session group.

Source

pub fn create_auto_grouped_session_with_base_index( &mut self, size: TerminalSize, base_index: u32, group_target: SessionName, ) -> Result<GroupedSessionCreation, RmuxError>

Creates an auto-named grouped session using tmux’s global session-id suffix rule (group-$id).

Source

pub fn next_grouped_session_name(&self, group_name: &SessionName) -> SessionName

Returns the next available grouped-session name using tmux’s group-N prefix shape.

Source

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

Removes a session or returns SessionNotFound when it is absent.

Source

pub fn insert_existing_session( &mut self, session: Session, ) -> Result<(), RmuxError>

Inserts an existing session back into the store without rewriting it.

Source

pub fn session_mut( &mut self, session_name: &SessionName, ) -> Option<&mut Session>

Returns a mutable reference to the named session.

Source

pub const fn next_session_id(&self) -> SessionId

Returns the next session id that will be allocated.

Source

pub const fn next_pane_id(&self) -> PaneId

Returns the next globally visible pane id that will be allocated.

Source

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

Renames the addressed session by updating both the stored key and the session’s internal name.

Source

pub fn allocate_pane_id(&mut self) -> PaneId

Allocates the next globally visible pane id for runtime-created panes.

Source§

impl SessionStore

Source

pub fn resolve_session(&self, target: &Target) -> Result<&Session, RmuxError>

Resolves any exact target to its owning session.

Source

pub fn resolve_session_mut( &mut self, target: &Target, ) -> Result<&mut Session, RmuxError>

Resolves any exact target to its owning mutable session.

Source

pub fn resolve_window(&self, target: &Target) -> Result<&Window, RmuxError>

Resolves any exact target to the addressed session window.

Source

pub fn resolve_window_mut( &mut self, target: &Target, ) -> Result<&mut Window, RmuxError>

Resolves any exact target to the addressed mutable session window.

Source

pub fn resolve_pane(&self, target: &Target) -> Result<&Pane, RmuxError>

Resolves an exact pane target to an immutable pane reference.

Source

pub fn resolve_pane_mut( &mut self, target: &Target, ) -> Result<&mut Pane, RmuxError>

Resolves an exact pane target to a mutable pane reference.

Source

pub fn resolve_effective_pane( &self, target: &Target, ) -> Result<&Pane, RmuxError>

Resolves a target to the effective pane used by pane-oriented commands.

Session and window targets resolve to the session’s active pane. Pane targets resolve to the explicitly addressed pane.

Source

pub fn resolve_effective_pane_mut( &mut self, target: &Target, ) -> Result<&mut Pane, RmuxError>

Resolves a target to the mutable effective pane used by pane-oriented commands.

Session and window targets resolve to the session’s active pane. Pane targets resolve to the explicitly addressed pane.

Source§

impl SessionStore

Source

pub fn resolve_unresolved_target( &self, target: &UnresolvedTarget, find_type: TargetFindType, flags: TargetFindFlags, context: &TargetFindContext, ) -> Result<Target, RmuxError>

Resolves an unresolved command target to the existing typed target representation.

Trait Implementations§

Source§

impl Debug for SessionStore

Source§

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

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

impl Default for SessionStore

Source§

fn default() -> SessionStore

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

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