pub trait MessageBase {
// Required methods
fn message_title(&self) -> Cow<'_, str>;
fn main_annotation(&self) -> Annotation<'_>;
// Provided methods
fn message_type(&self) -> AnnotationType { ... }
fn additional_annotations<'a, T: Extend<Annotation<'a>>>(
&'a self,
results: &mut T,
) { ... }
fn footers(&self) -> Vec<Footer<'_>> { ... }
}
Expand description
Helper for constructing a Message
Thanks to the blanket implementation impl<'a, T: MessageBase> From<&'a T> for Message<'a>
, implementors of this trait can be converted to a message
for free.
Required Methods§
sourcefn message_title(&self) -> Cow<'_, str>
fn message_title(&self) -> Cow<'_, str>
Returns the main caption of the message.
sourcefn main_annotation(&self) -> Annotation<'_>
fn main_annotation(&self) -> Annotation<'_>
Returns an annotation to be the first in the message.
Provided Methods§
sourcefn message_type(&self) -> AnnotationType
fn message_type(&self) -> AnnotationType
Returns the type of the entire message.
The default implementation returns AnnotationType::Error
.
sourcefn additional_annotations<'a, T: Extend<Annotation<'a>>>(
&'a self,
results: &mut T,
)
fn additional_annotations<'a, T: Extend<Annotation<'a>>>( &'a self, results: &mut T, )
Adds additional annotations to the given container.
The default implementation does nothing.
Returns footers that are included in the message.
Object Safety§
This trait is not object safe.