pub struct OverlayState { /* private fields */ }Expand description
Manages overlay visibility with mutual exclusion.
Only one overlay can be visible at a time - showing a new overlay automatically closes others.
§Example
ⓘ
use crate::tui::viewmodel::OverlayState;
let mut overlay = OverlayState::new();
overlay.toggle(OverlayKind::Help);
assert!(overlay.is_showing(OverlayKind::Help));
overlay.toggle(OverlayKind::Export);
assert!(overlay.is_showing(OverlayKind::Export));
assert!(!overlay.is_showing(OverlayKind::Help)); // Auto-closedImplementations§
Source§impl OverlayState
impl OverlayState
Sourcepub const fn has_overlay(&self) -> bool
pub const fn has_overlay(&self) -> bool
Check if any overlay is currently visible.
Sourcepub fn is_showing(&self, kind: OverlayKind) -> bool
pub fn is_showing(&self, kind: OverlayKind) -> bool
Check if a specific overlay is visible.
Sourcepub const fn current(&self) -> Option<OverlayKind>
pub const fn current(&self) -> Option<OverlayKind>
Get the currently visible overlay.
Sourcepub const fn show(&mut self, kind: OverlayKind)
pub const fn show(&mut self, kind: OverlayKind)
Show a specific overlay, closing any other.
Sourcepub fn toggle(&mut self, kind: OverlayKind)
pub fn toggle(&mut self, kind: OverlayKind)
Toggle a specific overlay.
If the overlay is showing, close it. Otherwise, show it.
Sourcepub fn toggle_help(&mut self)
pub fn toggle_help(&mut self)
Toggle help overlay.
Sourcepub fn toggle_export(&mut self)
pub fn toggle_export(&mut self)
Toggle export overlay.
Sourcepub fn toggle_legend(&mut self)
pub fn toggle_legend(&mut self)
Toggle legend overlay.
Sourcepub fn show_export(&self) -> bool
pub fn show_export(&self) -> bool
Check if export overlay is visible.
Sourcepub fn show_legend(&self) -> bool
pub fn show_legend(&self) -> bool
Check if legend overlay is visible.
Trait Implementations§
Source§impl Clone for OverlayState
impl Clone for OverlayState
Source§fn clone(&self) -> OverlayState
fn clone(&self) -> OverlayState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OverlayState
impl Debug for OverlayState
Source§impl Default for OverlayState
impl Default for OverlayState
Source§fn default() -> OverlayState
fn default() -> OverlayState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OverlayState
impl RefUnwindSafe for OverlayState
impl Send for OverlayState
impl Sync for OverlayState
impl Unpin for OverlayState
impl UnsafeUnpin for OverlayState
impl UnwindSafe for OverlayState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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