pub struct StatusMessage { /* private fields */ }Expand description
Manages temporary status messages with optional auto-clear.
Status messages are displayed briefly to notify users of actions (e.g., “Exported to file.json”, “Copied to clipboard”).
§Example
ⓘ
use crate::tui::viewmodel::StatusMessage;
let mut status = StatusMessage::new();
status.set("File exported successfully");
assert!(status.message().is_some());
status.clear();
assert!(status.message().is_none());Implementations§
Source§impl StatusMessage
impl StatusMessage
Sourcepub const fn with_auto_clear(duration: Duration) -> Self
pub const fn with_auto_clear(duration: Duration) -> Self
Create a status message manager with auto-clear after duration.
Sourcepub fn message(&mut self) -> Option<&str>
pub fn message(&mut self) -> Option<&str>
Get the current message (checking auto-clear if configured).
Sourcepub fn peek(&self) -> Option<&str>
pub fn peek(&self) -> Option<&str>
Get the current message without checking auto-clear.
Use this when you don’t want to mutate state.
Sourcepub const fn has_message(&self) -> bool
pub const fn has_message(&self) -> bool
Check if there’s an active message.
Trait Implementations§
Source§impl Clone for StatusMessage
impl Clone for StatusMessage
Source§fn clone(&self) -> StatusMessage
fn clone(&self) -> StatusMessage
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 StatusMessage
impl Debug for StatusMessage
Source§impl Default for StatusMessage
impl Default for StatusMessage
Source§fn default() -> StatusMessage
fn default() -> StatusMessage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StatusMessage
impl RefUnwindSafe for StatusMessage
impl Send for StatusMessage
impl Sync for StatusMessage
impl Unpin for StatusMessage
impl UnsafeUnpin for StatusMessage
impl UnwindSafe for StatusMessage
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