[][src]Trait crossterm_utils::QueueableCommand

pub trait QueueableCommand<T: Display>: Sized {
    fn queue(
        &mut self,
        command: impl Command<AnsiType = T>
    ) -> Result<&mut Self>; }

A trait that defines behaviour for a command that can be used to be executed at a later time point. This can be used in order to get more performance.

Required methods

fn queue(&mut self, command: impl Command<AnsiType = T>) -> Result<&mut Self>

Queues the given command for later execution.

Loading content...

Implementors

impl<T, A> QueueableCommand<A> for T where
    A: Display,
    T: Write
[src]

fn queue(&mut self, command: impl Command<AnsiType = A>) -> Result<&mut Self>[src]

Queue the given command for later execution.

Queued commands will be executed in the following cases:

  • When you manually call flush on the given writer.
  • When the buffer is to full, then the terminal will flush for you.
  • Incase of stdout each line, because stdout is line buffered.

Parameters

  • Command

    The command that you want to queue for later execution.

Remarks

  • In the case of UNIX and windows 10, ANSI codes are written to the given 'writer'.
  • In case of Windows versions lower than 10, a direct WinApi call will be made. This is happening because windows versions lower then 10 do not support ANSI codes, and thus they can't be written to the given buffer. Because of that there is no difference between execute and queue for those windows versions.
  • Queuing might sound that there is some scheduling going on, however, this means that we write to the stdout without flushing which will cause commands to be stored in the buffer without them being written to the terminal.
Loading content...