[][src]Trait crossterm_cursor::QueueableCommand

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

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<impl Command>(
    self,
    command: impl Command
) -> Self where
    impl Command: Command<AnsiType = T>, 

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<impl Command>(
    self,
    command: impl Command
) -> T where
    impl Command: Command<AnsiType = A>, 
[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.

Check the command API for more information and all available commands.

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...