pub trait InitialContent {
    // Required method
    fn init_buffer(&self, buffer: &mut Buffer);
}
Expand description

Initial content for a buffer

This wouldn’t actually be the first thing in the buffer if it has been obtained using a method that adds the tag, which comes first.

Unfortunately it is not possible to implement this trait for all std::fmt::Display types. It is implemented for &str however, and that is usually enough. If it isn’t, the Wrap::Plain wrapper can be used, because this trait is implemented for all Inline types.

To provide no initial content, use one of the following:

con.status(..);
con.status(());
con.status(None);

Required Methods§

source

fn init_buffer(&self, buffer: &mut Buffer)

Initialize the buffer

Implementations on Foreign Types§

source§

impl InitialContent for &str

Initialize the buffer with a string literal: con.status("Test123 :^)")

source§

fn init_buffer(&self, buf: &mut Buffer)

source§

impl InitialContent for Option<()>

Provide no initial content: con.status(None)

source§

fn init_buffer(&self, _buf: &mut Buffer)

source§

impl InitialContent for ()

Provide no initial content: con.status(())

source§

fn init_buffer(&self, _buf: &mut Buffer)

source§

impl InitialContent for String

Initialize the buffer with a String: con.status(format!("Test123 :^)"))

source§

fn init_buffer(&self, buf: &mut Buffer)

source§

impl InitialContent for Arguments<'_>

Initialize the buffer with format_args!: just as convenient as format! but without allocating

con.status(format_args!("Test123 :^)"))

source§

fn init_buffer(&self, buf: &mut Buffer)

source§

impl InitialContent for RangeFull

Provide no initial content: con.status(..)

This is unidiomatic but I don’t like con.status(())

source§

fn init_buffer(&self, _buf: &mut Buffer)

Implementors§

source§

impl<T: Inline + ?Sized> InitialContent for T

Initialize with a Inline implementor