Struct BufferLine

Source
pub struct BufferLine<'a> { /* private fields */ }
Expand description

The buffer line, makes it possible to modify the printed message and other line data.

Implementations§

Source§

impl<'a> BufferLine<'a>

Source

pub fn prefix(&self) -> Cow<'_, str>

Get the prefix of the line, everything left of the message separator (usually |) is considered the prefix.

Source

pub fn set_prefix(&self, new_prefix: &str)

Set the prefix to the given new value.

§Arguments
  • new_prefix - The new prefix that should be set on the line.
Source

pub fn message(&self) -> Cow<'_, str>

Get the message of the line.

Source

pub fn set_message(&self, new_value: &str)

Set the message to the given new value.

§Arguments
  • new_value - The new message that should be set on the line.
Source

pub fn date(&self) -> i64

Get the date of the line.

Source

pub fn set_date(&self, new_value: i64)

Set the date to the given new value.

§Arguments
  • new_value - The new date that should be set on the line.
Source

pub fn date_printed(&self) -> i64

Get the date the line was printed.

Source

pub fn set_date_printed(&self, new_value: &str)

Set the date the line was printed to the given new value.

§Arguments
  • new_value - The new date that should be set on the line.
Source

pub fn highlighted(&self) -> bool

Is the line highlighted.

Source

pub fn tags(&self) -> Vec<Cow<'_, str>>

Get the list of tags of the line.

Source

pub fn set_tags(&self, new_value: &[&str])

Set the tags of the line to the new value.

§Arguments
  • new_value - The new tags that should be set on the line.
Source

pub fn update(&self, data: LineData<'a>)

Update multiple fields of the line at once.

§Arguments
  • data - LineData that contains new values that should be set on the line.
§Example

let new_line = LineData {
    message: Some("Hello world"),
    tags: Some(&["First", "Second tag"]),
    .. Default::default()
};

line.update(new_line)

Auto Trait Implementations§

§

impl<'a> Freeze for BufferLine<'a>

§

impl<'a> !RefUnwindSafe for BufferLine<'a>

§

impl<'a> !Send for BufferLine<'a>

§

impl<'a> !Sync for BufferLine<'a>

§

impl<'a> Unpin for BufferLine<'a>

§

impl<'a> !UnwindSafe for BufferLine<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.