Trait anstream::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 Stdout

§

type Locked = StdoutLock<'static>

source§

fn lock(self) -> Self::Locked

source§

impl<S> Lockable for Console<S>where S: RawStream + Lockable, <S as Lockable>::Locked: RawStream,

Available on Windows and crate feature wincon only.
§

type Locked = Console<<S as Lockable>::Locked>

source§

fn lock(self) -> Self::Locked

source§

impl Lockable for Stderr

§

type Locked = StderrLock<'static>

source§

fn lock(self) -> Self::Locked

Implementors§

source§

impl<S> Lockable for AutoStream<S>where S: Lockable + RawStream, <S as Lockable>::Locked: RawStream,

source§

impl<S> Lockable for StripStream<S>where S: Lockable,

source§

impl<S> Lockable for WinconStream<S>where S: RawStream + Lockable, <S as Lockable>::Locked: RawStream,

Available on Windows and crate feature wincon only.