Message

Trait Message 

Source
pub trait Message {
    // Provided methods
    fn text(self) -> String
       where Self: Sized { ... }
    fn structured<S: Serializer>(self, ser: S) -> Result<S::Ok, S::Error>
       where Self: Sized { ... }
}
Expand description

A typed object that can be either printed as a human-readable message or serialized as JSON.

The TypedMessage and Status structs are the most frequently used kinds of messages.

Provided Methods§

Source

fn text(self) -> String
where Self: Sized,

Return textual representation of this message.

Default implementation returns empty string, making Ui skip printing this message.

Source

fn structured<S: Serializer>(self, ser: S) -> Result<S::Ok, S::Error>
where Self: Sized,

Serialize this structured message to a serializer which is routed to Ui output stream.

Default implementation does not serialize anything, making Ui skip printing this message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Message for &str

Source§

fn text(self) -> String

Source§

impl Message for String

Source§

fn text(self) -> String

Implementors§