pub struct ViewContext<'a> {
pub mode: ViewMode,
pub focused: bool,
pub width: u16,
pub height: u16,
pub tick: u64,
pub status_message: &'a mut Option<String>,
}Expand description
Context provided to views for accessing shared state
Fields§
§mode: ViewModeCurrent application mode
focused: boolWhether the view is currently focused
width: u16Terminal width
height: u16Terminal height
tick: u64Current tick count for animations
status_message: &'a mut Option<String>Mutable status message slot
Implementations§
Source§impl ViewContext<'_>
impl ViewContext<'_>
Sourcepub fn set_status(&mut self, msg: impl Into<String>)
pub fn set_status(&mut self, msg: impl Into<String>)
Set a status message
Sourcepub fn clear_status(&mut self)
pub fn clear_status(&mut self)
Clear the status message
Auto Trait Implementations§
impl<'a> Freeze for ViewContext<'a>
impl<'a> RefUnwindSafe for ViewContext<'a>
impl<'a> Send for ViewContext<'a>
impl<'a> Sync for ViewContext<'a>
impl<'a> Unpin for ViewContext<'a>
impl<'a> UnsafeUnpin for ViewContext<'a>
impl<'a> !UnwindSafe for ViewContext<'a>
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 more