pub enum OutputCommand {
Show 43 variants
MoveTo(u16, u16),
MoveUp(u16),
MoveDown(u16),
MoveLeft(u16),
MoveRight(u16),
MoveToNextLine(u16),
MoveToPreviousLine(u16),
MoveToColumn(u16),
SavePosition,
RestorePosition,
GetPosition,
Hide,
Show,
EnableBlinking,
DisableBlinking,
SetCursorStyle(CursorStyle),
Print(String),
PrintLine(String),
PrintStyled(StyledText),
SetForegroundColor(Color),
SetBackgroundColor(Color),
ResetColor,
SetColors(Color, Color),
SetAttribute(Attribute),
ResetAttributes,
SetLineWrap(bool),
Clear(ClearType),
ScrollUp(u16),
ScrollDown(u16),
SetSize(u16, u16),
GetSize,
EnterAlternateScreen,
LeaveAlternateScreen,
SetTitle(String),
EnableMouseCapture,
DisableMouseCapture,
EnableFocusReporting,
DisableFocusReporting,
PushKeyboardEvent(KeyEvent),
PushMouseEvent(MouseEvent),
Batch(Vec<OutputCommand>),
If(bool, Box<OutputCommand>, Option<Box<OutputCommand>>),
Repeat(u32, Box<OutputCommand>),
}Expand description
完整的终端控制命令枚举
Variants§
MoveTo(u16, u16)
移动光标到指定位置 (列, 行),从 (1,1) 开始
MoveUp(u16)
光标上移 n 行
MoveDown(u16)
光标下移 n 行
MoveLeft(u16)
光标左移 n 列
MoveRight(u16)
光标右移 n 列
MoveToNextLine(u16)
光标移动到下一行,列位置不变
MoveToPreviousLine(u16)
光标移动到上一行,列位置不变
MoveToColumn(u16)
光标移动到指定列
SavePosition
保存光标位置
RestorePosition
恢复光标位置
GetPosition
获取光标位置(返回 (列, 行))
Hide
隐藏光标
Show
显示光标
EnableBlinking
启用光标闪烁
DisableBlinking
禁用光标闪烁
SetCursorStyle(CursorStyle)
设置光标形状
Print(String)
打印文本
PrintLine(String)
打印一行文本(自动换行)
PrintStyled(StyledText)
打印带样式的文本
SetForegroundColor(Color)
设置前景色
SetBackgroundColor(Color)
设置背景色
ResetColor
重置颜色(前景和背景)
SetColors(Color, Color)
同时设置前景和背景色
SetAttribute(Attribute)
设置文本属性
ResetAttributes
重置所有样式
SetLineWrap(bool)
启用/禁用自动换行
Clear(ClearType)
清除屏幕
ScrollUp(u16)
滚动屏幕
ScrollDown(u16)
SetSize(u16, u16)
设置终端大小
GetSize
获取终端大小
EnterAlternateScreen
进入备用屏幕缓冲区
LeaveAlternateScreen
退出备用屏幕缓冲区
SetTitle(String)
设置终端标题
EnableMouseCapture
启用鼠标捕获
DisableMouseCapture
禁用鼠标捕获
EnableFocusReporting
启用焦点事件报告
DisableFocusReporting
禁用焦点事件报告
PushKeyboardEvent(KeyEvent)
推送键盘事件(用于模拟输入)
PushMouseEvent(MouseEvent)
推送鼠标事件(用于模拟输入)
Batch(Vec<OutputCommand>)
执行多个命令
If(bool, Box<OutputCommand>, Option<Box<OutputCommand>>)
条件执行
Repeat(u32, Box<OutputCommand>)
循环执行
Implementations§
Source§impl OutputCommand
impl OutputCommand
Sourcepub fn print_line<S: Into<String>>(text: S) -> Self
pub fn print_line<S: Into<String>>(text: S) -> Self
创建打印行命令
Sourcepub fn set_colors(foreground: Color, background: Color) -> Self
pub fn set_colors(foreground: Color, background: Color) -> Self
创建设置颜色命令
Sourcepub fn batch<I>(commands: I) -> Selfwhere
I: IntoIterator<Item = OutputCommand>,
pub fn batch<I>(commands: I) -> Selfwhere
I: IntoIterator<Item = OutputCommand>,
创建批处理命令
Sourcepub fn if_then_else<C, T, E>(
condition: bool,
then_cmd: C,
else_cmd: Option<E>,
) -> Self
pub fn if_then_else<C, T, E>( condition: bool, then_cmd: C, else_cmd: Option<E>, ) -> Self
创建条件命令
Sourcepub fn repeat<C>(count: u32, cmd: C) -> Selfwhere
C: Into<OutputCommand>,
pub fn repeat<C>(count: u32, cmd: C) -> Selfwhere
C: Into<OutputCommand>,
创建重复命令
Sourcepub fn styled_text<S, F, B, A>(
text: S,
foreground: Option<F>,
background: Option<B>,
attributes: A,
) -> StyledText
pub fn styled_text<S, F, B, A>( text: S, foreground: Option<F>, background: Option<B>, attributes: A, ) -> StyledText
创建带样式的文本
Sourcepub fn print_styled(styled: StyledText) -> Self
pub fn print_styled(styled: StyledText) -> Self
从带样式的文本创建命令
Trait Implementations§
Source§impl Clone for OutputCommand
impl Clone for OutputCommand
Source§fn clone(&self) -> OutputCommand
fn clone(&self) -> OutputCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OutputCommand
impl Debug for OutputCommand
Auto Trait Implementations§
impl Freeze for OutputCommand
impl RefUnwindSafe for OutputCommand
impl Send for OutputCommand
impl Sync for OutputCommand
impl Unpin for OutputCommand
impl UnwindSafe for OutputCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more