[−][src]Trait crossterm_terminal::QueueableCommand
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>,
self,
command: impl Command
) -> Self where
impl Command
Queues the given command for later execution.
Implementors
impl<T, A> QueueableCommand<A> for T where
A: Display,
T: Write,
[src]
A: Display,
T: Write,
fn queue<impl Command>(
self,
command: impl Command
) -> T where
impl Command: Command<AnsiType = A>,
[src]
self,
command: impl Command
) -> T where
impl Command
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, becausestdout
is line buffered.
Check the command API for more information and all available commands.
Parameters
-
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
andqueue
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.