pub struct TuiState {
pub sessions: Vec<TuiSession>,
pub event_tx: Sender<TuiEvent>,
pub default_cols: u16,
pub default_rows: u16,
pub default_scrollback: usize,
/* private fields */
}Expand description
Top-level TUI multiplexer state.
Owns all sessions and provides a broadcast channel for state change events. The composite buffer and generation counter are used by the frame loop to detect changes and encode diffs.
Fields§
§sessions: Vec<TuiSession>All sessions.
event_tx: Sender<TuiEvent>Event broadcast sender.
default_cols: u16Default terminal dimensions.
default_rows: u16§default_scrollback: usizeDefault scrollback lines per pane.
Implementations§
Source§impl TuiState
impl TuiState
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Get the current generation.
Sourcepub fn next_generation(&self) -> u64
pub fn next_generation(&self) -> u64
Increment and return the new generation.
Sourcepub fn create_session(&mut self) -> u32
pub fn create_session(&mut self) -> u32
Create a new session.
Sourcepub fn session(&self, session_id: u32) -> Option<&TuiSession>
pub fn session(&self, session_id: u32) -> Option<&TuiSession>
Find a session by ID.
Sourcepub fn session_mut(&mut self, session_id: u32) -> Option<&mut TuiSession>
pub fn session_mut(&mut self, session_id: u32) -> Option<&mut TuiSession>
Find a session by ID mutably.
Sourcepub fn create_window(&mut self, session_id: u32) -> Option<u32>
pub fn create_window(&mut self, session_id: u32) -> Option<u32>
Create a new window in a session.
Sourcepub fn next_pane_id(&mut self) -> u32
pub fn next_pane_id(&mut self) -> u32
Allocate a new pane ID.
Sourcepub fn close_window(&mut self, session_id: u32, window_id: u32) -> bool
pub fn close_window(&mut self, session_id: u32, window_id: u32) -> bool
Close a window in a session. Returns true if the window was found and removed.
Sourcepub fn focus_window(&mut self, session_id: u32, window_id: u32) -> bool
pub fn focus_window(&mut self, session_id: u32, window_id: u32) -> bool
Focus a window in a session. Returns true if the window exists.
Sourcepub fn split_pane(
&mut self,
session_id: u32,
horizontal: bool,
ratio: f32,
) -> Option<(u32, u16, u16)>
pub fn split_pane( &mut self, session_id: u32, horizontal: bool, ratio: f32, ) -> Option<(u32, u16, u16)>
Split the active pane in the active window. Returns (new_pane_id, cols, rows) on success.
Sourcepub fn close_pane(&mut self, session_id: u32, pane_id: u32) -> bool
pub fn close_pane(&mut self, session_id: u32, pane_id: u32) -> bool
Close a pane in the active window. Returns true if found and removed.
Sourcepub fn focus_pane(&mut self, session_id: u32, pane_id: u32) -> bool
pub fn focus_pane(&mut self, session_id: u32, pane_id: u32) -> bool
Focus a pane in the active window. Returns true if the pane exists.
Sourcepub fn notify_damage(&self, session_id: u32, window_id: u32, pane_id: u32)
pub fn notify_damage(&self, session_id: u32, window_id: u32, pane_id: u32)
Notify that a pane has been damaged (content changed).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TuiState
impl !RefUnwindSafe for TuiState
impl Send for TuiState
impl Sync for TuiState
impl Unpin for TuiState
impl UnsafeUnpin for TuiState
impl !UnwindSafe for TuiState
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request