Trait Lockable

Source
pub trait Lockable {
    type Locked;

    // Required method
    fn lock(self) -> Self::Locked;
}
Expand description

Explicitly lock a std::io::Writeable

Required Associated Types§

Required Methods§

Source

fn lock(self) -> Self::Locked

Get exclusive access to the AutoStream

Why?

  • Faster performance when writing in a loop
  • Avoid other threads interleaving output with the current thread

Implementations on Foreign Types§

Source§

impl Lockable for Stderr

Source§

type Locked = StderrLock<'static>

Source§

fn lock(self) -> Self::Locked

Source§

impl Lockable for Stdout

Source§

type Locked = StdoutLock<'static>

Source§

fn lock(self) -> Self::Locked

Implementors§