pub struct Message { /* private fields */ }Expand description
The public-facing container for any log message.
This struct wraps a Box<dyn MessageImpl>, providing a uniform API
regardless of the underlying data type.
Implementations§
Source§impl Message
impl Message
Sourcepub fn new(m_impl: Box<dyn MessageImpl + Send + Sync>) -> Self
pub fn new(m_impl: Box<dyn MessageImpl + Send + Sync>) -> Self
Creates a new message from a concrete implementation. The implementation is moved into a Box and becomes owned by the Message.
Sourcepub fn level(&self) -> &dyn Display
pub fn level(&self) -> &dyn Display
Accesses the log level (e.g., “INFO”). Returns a dynamic reference to an object implementing Display.
Sourcepub fn content(&self) -> &dyn Display
pub fn content(&self) -> &dyn Display
Accesses the message content. The formatting is deferred until the Display trait is actually invoked.
Sourcepub fn instant(&self) -> SystemTime
pub fn instant(&self) -> SystemTime
Returns the creation timestamp.
Sourcepub fn implementation(&self) -> &dyn MessageImpl
pub fn implementation(&self) -> &dyn MessageImpl
Accesses the underlying implementation for downcasting purposes. This returns a reference to the trait object itself.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl !RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl !UnwindSafe for Message
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
§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 moreCreates a shared type from an unshared type.