Trait scarb_ui::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) -> Stringwhere 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.

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§

source§

impl<'a> Message for Status<'a>

source§

impl<'a> Message for TypedMessage<'a>

source§

impl<'a, T> Message for ValueMessage<'a, T>where T: Display + Serialize,

source§

impl<T> Message for MachineMessage<T>where T: Serialize,