pub struct SubAgentSidebarState {
pub list_state: ListState,
}Expand description
Selection and scroll state for the interactive sub-agent sidebar.
Wraps a ratatui ListState with convenience
helpers that clamp the selection to valid indices.
§Examples
use zeph_tui::app::SubAgentSidebarState;
let mut state = SubAgentSidebarState::new();
state.select_next(3);
assert_eq!(state.selected(), Some(0));Fields§
§list_state: ListStateUnderlying ratatui list selection state.
Implementations§
Source§impl SubAgentSidebarState
impl SubAgentSidebarState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new sidebar state with no selection.
§Examples
use zeph_tui::app::SubAgentSidebarState;
let state = SubAgentSidebarState::new();
assert_eq!(state.selected(), None);Sourcepub fn select_next(&mut self, count: usize)
pub fn select_next(&mut self, count: usize)
Advance the selection to the next item, clamped to count - 1.
A no-op when count is zero.
Sourcepub fn select_prev(&mut self, count: usize)
pub fn select_prev(&mut self, count: usize)
Move the selection to the previous item, clamped to 0.
A no-op when count is zero.
Sourcepub fn clamp(&mut self, count: usize)
pub fn clamp(&mut self, count: usize)
Ensure the selection is valid given the current agent count.
Sourcepub fn selected(&self) -> Option<usize>
pub fn selected(&self) -> Option<usize>
Returns the currently selected index, or None if nothing is selected.
§Examples
use zeph_tui::app::SubAgentSidebarState;
let mut state = SubAgentSidebarState::new();
assert_eq!(state.selected(), None);
state.select_next(5);
assert_eq!(state.selected(), Some(0));Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubAgentSidebarState
impl RefUnwindSafe for SubAgentSidebarState
impl Send for SubAgentSidebarState
impl Sync for SubAgentSidebarState
impl Unpin for SubAgentSidebarState
impl UnsafeUnpin for SubAgentSidebarState
impl UnwindSafe for SubAgentSidebarState
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request