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 Stream

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 Stdout

§

type Locked = StdoutLock<'static>

source§

fn lock(self) -> Self::Locked

source§

impl Lockable for Stderr

§

type Locked = StderrLock<'static>

source§

fn lock(self) -> Self::Locked

Implementors§