pub struct StatusLogEntry { /* private fields */ }Expand description
A single status log entry.
Implementations§
Source§impl StatusLogEntry
impl StatusLogEntry
Sourcepub fn new(id: u64, message: impl Into<String>, level: StatusLogLevel) -> Self
pub fn new(id: u64, message: impl Into<String>, level: StatusLogLevel) -> Self
Creates a new status log entry.
§Example
use envision::component::{StatusLogEntry, StatusLogLevel};
let entry = StatusLogEntry::new(0, "Starting", StatusLogLevel::Info);
assert_eq!(entry.id(), 0);
assert_eq!(entry.message(), "Starting");
assert_eq!(entry.level(), StatusLogLevel::Info);
assert_eq!(entry.timestamp(), None);Sourcepub fn with_timestamp(
id: u64,
message: impl Into<String>,
level: StatusLogLevel,
timestamp: impl Into<String>,
) -> Self
pub fn with_timestamp( id: u64, message: impl Into<String>, level: StatusLogLevel, timestamp: impl Into<String>, ) -> Self
Creates a new entry with a timestamp.
§Example
use envision::component::{StatusLogEntry, StatusLogLevel};
let entry = StatusLogEntry::with_timestamp(1, "Done", StatusLogLevel::Success, "12:00:00");
assert_eq!(entry.timestamp(), Some("12:00:00"));Sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Returns the entry ID.
§Example
use envision::component::{StatusLogEntry, StatusLogLevel};
let entry = StatusLogEntry::new(42, "Test", StatusLogLevel::Info);
assert_eq!(entry.id(), 42);Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
Returns the message.
§Example
use envision::component::{StatusLogEntry, StatusLogLevel};
let entry = StatusLogEntry::new(0, "Hello", StatusLogLevel::Info);
assert_eq!(entry.message(), "Hello");Sourcepub fn level(&self) -> StatusLogLevel
pub fn level(&self) -> StatusLogLevel
Returns the level.
§Example
use envision::component::{StatusLogEntry, StatusLogLevel};
let entry = StatusLogEntry::new(0, "Warning!", StatusLogLevel::Warning);
assert_eq!(entry.level(), StatusLogLevel::Warning);Trait Implementations§
Source§impl Clone for StatusLogEntry
impl Clone for StatusLogEntry
Source§fn clone(&self) -> StatusLogEntry
fn clone(&self) -> StatusLogEntry
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 StatusLogEntry
impl Debug for StatusLogEntry
Source§impl<'de> Deserialize<'de> for StatusLogEntry
impl<'de> Deserialize<'de> for StatusLogEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StatusLogEntry
impl PartialEq for StatusLogEntry
Source§impl Serialize for StatusLogEntry
impl Serialize for StatusLogEntry
impl StructuralPartialEq for StatusLogEntry
Auto Trait Implementations§
impl Freeze for StatusLogEntry
impl RefUnwindSafe for StatusLogEntry
impl Send for StatusLogEntry
impl Sync for StatusLogEntry
impl Unpin for StatusLogEntry
impl UnsafeUnpin for StatusLogEntry
impl UnwindSafe for StatusLogEntry
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> 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