pub struct SessionStore { /* private fields */ }Expand description
In-memory storage for all sessions owned by the server.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn contains_session(&self, session_name: &SessionName) -> bool
pub fn contains_session(&self, session_name: &SessionName) -> bool
Returns whether the addressed session exists.
Sourcepub fn session(&self, session_name: &SessionName) -> Option<&Session>
pub fn session(&self, session_name: &SessionName) -> Option<&Session>
Returns an immutable reference to the named session.
Sourcepub fn session_by_id(
&self,
session_id: impl Into<SessionId>,
) -> Option<&Session>
pub fn session_by_id( &self, session_id: impl Into<SessionId>, ) -> Option<&Session>
Returns the session with the store-assigned $N identity.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&SessionName, &Session)>
pub fn iter(&self) -> impl Iterator<Item = (&SessionName, &Session)>
Returns an iterator over all sessions in the store.
Sourcepub fn session_group_name(
&self,
session_name: &SessionName,
) -> Option<&SessionName>
pub fn session_group_name( &self, session_name: &SessionName, ) -> Option<&SessionName>
Returns the stable session group name for the addressed session.
Sourcepub fn runtime_owner(&self, session_name: &SessionName) -> Option<SessionName>
pub fn runtime_owner(&self, session_name: &SessionName) -> Option<SessionName>
Returns the runtime-owning session for the addressed session.
Sourcepub fn runtime_owner_transfer_target(
&self,
session_name: &SessionName,
) -> Option<SessionName>
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.
Sourcepub fn session_group_members(
&self,
session_name: &SessionName,
) -> Vec<SessionName>
pub fn session_group_members( &self, session_name: &SessionName, ) -> Vec<SessionName>
Returns the grouped peer sessions for the addressed session in stable name order.
Sourcepub fn session_group_size(&self, session_name: &SessionName) -> usize
pub fn session_group_size(&self, session_name: &SessionName) -> usize
Returns the number of sessions sharing the addressed session’s group.
Sourcepub fn contains_group(&self, group_name: &SessionName) -> bool
pub fn contains_group(&self, group_name: &SessionName) -> bool
Returns whether a named session group exists.
Sourcepub fn sessions_in_group(&self, group_name: &SessionName) -> Vec<SessionName>
pub fn sessions_in_group(&self, group_name: &SessionName) -> Vec<SessionName>
Returns grouped sessions for the named group in stable name order.
Sourcepub fn create_session(
&mut self,
session_name: SessionName,
size: TerminalSize,
) -> Result<(), RmuxError>
pub fn create_session( &mut self, session_name: SessionName, size: TerminalSize, ) -> Result<(), RmuxError>
Creates a session or returns DuplicateSession when the name exists.
Sourcepub fn create_session_with_base_index(
&mut self,
session_name: SessionName,
size: TerminalSize,
base_index: u32,
) -> Result<(), RmuxError>
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.
Sourcepub fn create_auto_named_session_with_base_index(
&mut self,
size: TerminalSize,
base_index: u32,
) -> Result<SessionName, RmuxError>
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.
Sourcepub fn create_grouped_session_with_base_index(
&mut self,
session_name: SessionName,
size: TerminalSize,
base_index: u32,
group_target: SessionName,
) -> Result<GroupedSessionCreation, RmuxError>
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.
Sourcepub fn create_auto_grouped_session_with_base_index(
&mut self,
size: TerminalSize,
base_index: u32,
group_target: SessionName,
) -> Result<GroupedSessionCreation, RmuxError>
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).
Sourcepub fn next_grouped_session_name(&self, group_name: &SessionName) -> SessionName
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.
Sourcepub fn remove_session(
&mut self,
session_name: &SessionName,
) -> Result<Session, RmuxError>
pub fn remove_session( &mut self, session_name: &SessionName, ) -> Result<Session, RmuxError>
Removes a session or returns SessionNotFound when it is absent.
Sourcepub fn insert_existing_session(
&mut self,
session: Session,
) -> Result<(), RmuxError>
pub fn insert_existing_session( &mut self, session: Session, ) -> Result<(), RmuxError>
Inserts an existing session back into the store without rewriting it.
Sourcepub fn session_mut(
&mut self,
session_name: &SessionName,
) -> Option<&mut Session>
pub fn session_mut( &mut self, session_name: &SessionName, ) -> Option<&mut Session>
Returns a mutable reference to the named session.
Sourcepub const fn next_session_id(&self) -> SessionId
pub const fn next_session_id(&self) -> SessionId
Returns the next session id that will be allocated.
Sourcepub const fn next_pane_id(&self) -> PaneId
pub const fn next_pane_id(&self) -> PaneId
Returns the next globally visible pane id that will be allocated.
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>
Renames the addressed session by updating both the stored key and the session’s internal name.
Sourcepub fn allocate_pane_id(&mut self) -> PaneId
pub fn allocate_pane_id(&mut self) -> PaneId
Allocates the next globally visible pane id for runtime-created panes.
Source§impl SessionStore
impl SessionStore
Sourcepub fn resolve_session(&self, target: &Target) -> Result<&Session, RmuxError>
pub fn resolve_session(&self, target: &Target) -> Result<&Session, RmuxError>
Resolves any exact target to its owning session.
Sourcepub fn resolve_session_mut(
&mut self,
target: &Target,
) -> Result<&mut Session, RmuxError>
pub fn resolve_session_mut( &mut self, target: &Target, ) -> Result<&mut Session, RmuxError>
Resolves any exact target to its owning mutable session.
Sourcepub fn resolve_window(&self, target: &Target) -> Result<&Window, RmuxError>
pub fn resolve_window(&self, target: &Target) -> Result<&Window, RmuxError>
Resolves any exact target to the addressed session window.
Sourcepub fn resolve_window_mut(
&mut self,
target: &Target,
) -> Result<&mut Window, RmuxError>
pub fn resolve_window_mut( &mut self, target: &Target, ) -> Result<&mut Window, RmuxError>
Resolves any exact target to the addressed mutable session window.
Sourcepub fn resolve_pane(&self, target: &Target) -> Result<&Pane, RmuxError>
pub fn resolve_pane(&self, target: &Target) -> Result<&Pane, RmuxError>
Resolves an exact pane target to an immutable pane reference.
Sourcepub fn resolve_pane_mut(
&mut self,
target: &Target,
) -> Result<&mut Pane, RmuxError>
pub fn resolve_pane_mut( &mut self, target: &Target, ) -> Result<&mut Pane, RmuxError>
Resolves an exact pane target to a mutable pane reference.
Sourcepub fn resolve_effective_pane(
&self,
target: &Target,
) -> Result<&Pane, RmuxError>
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.
Sourcepub fn resolve_effective_pane_mut(
&mut self,
target: &Target,
) -> Result<&mut Pane, RmuxError>
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
impl SessionStore
Sourcepub fn resolve_unresolved_target(
&self,
target: &UnresolvedTarget,
find_type: TargetFindType,
flags: TargetFindFlags,
context: &TargetFindContext,
) -> Result<Target, RmuxError>
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.