pub struct SystemMessage {
pub text: String,
pub sys_code: Option<String>,
pub timestamp: Instant,
pub min_display_duration: Duration,
}Expand description
A system message with display timing information.
Fields§
§text: StringThe message text
sys_code: Option<String>Optional system code (e.g., “server_connection_down”)
timestamp: InstantWhen this message was added to the queue
min_display_duration: DurationMinimum duration to display this message (default 3 seconds)
Implementations§
Source§impl SystemMessage
impl SystemMessage
Sourcepub fn new(text: String) -> Self
pub fn new(text: String) -> Self
Create a new system message with default 3-second display duration.
Sourcepub fn with_code(text: String, sys_code: String) -> Self
pub fn with_code(text: String, sys_code: String) -> Self
Create a new system message with a system code.
Sourcepub fn can_advance(&self) -> bool
pub fn can_advance(&self) -> bool
Check if the minimum display duration has elapsed.
Sourcepub fn reset_timestamp(&mut self)
pub fn reset_timestamp(&mut self)
Reset the timestamp to now (called when message starts displaying).
Trait Implementations§
Source§impl Clone for SystemMessage
impl Clone for SystemMessage
Source§fn clone(&self) -> SystemMessage
fn clone(&self) -> SystemMessage
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 moreAuto Trait Implementations§
impl Freeze for SystemMessage
impl RefUnwindSafe for SystemMessage
impl Send for SystemMessage
impl Sync for SystemMessage
impl Unpin for SystemMessage
impl UnwindSafe for SystemMessage
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,
§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>
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