Skip to main content

Writer

Struct Writer 

Source
pub struct Writer<'a, 'b: 'a, Term: 'b + Terminal> { /* private fields */ }
Expand description

Provides an interface to write line-by-line output to the terminal device.

Holds a lock on terminal write operations. See Interface for more information about concurrent operations.

An instance of this type can be constructed using either the Interface::lock_writer_append or the Interface::lock_writer_erase method.

Implementations§

Source§

impl<'a, 'b: 'a, Term: 'b + Terminal> Writer<'a, 'b, Term>

Source

pub fn history(&self) -> HistoryIter<'_>

Returns an iterator over history entries.

Source

pub fn write_str(&mut self, s: &str) -> Result<()>

Writes some text to the terminal device.

Before the Writer is dropped, any output written should be followed by a newline. A newline is automatically written if the writeln! macro is used.

Source

pub fn write_fmt(&mut self, args: Arguments<'_>) -> Result<()>

Writes formatted text to the terminal display.

This method enables Interface to be used as the receiver to the writeln! macro.

If the text contains any unprintable characters (e.g. escape sequences), those characters will be escaped before printing.

Trait Implementations§

Source§

impl<'a, 'b: 'a, Term: 'b + Terminal> Drop for Writer<'a, 'b, Term>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, 'b, Term> !RefUnwindSafe for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> !Send for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> !Sync for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> !UnwindSafe for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> Freeze for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> Unpin for Writer<'a, 'b, Term>

§

impl<'a, 'b, Term> UnsafeUnpin for Writer<'a, 'b, Term>

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.