Struct Termios

Source
#[repr(C)]
pub struct Termios { pub iflag: InputFlags, pub oflag: OutputFlags, pub cflag: u32, pub lflag: LocalFlags, pub line: u8, pub cc: [u8; 32], pub ispeed: u32, pub ospeed: u32, }
Expand description

termios 结构体用于控制异步通信端口(如串口、终端)的通用终端接口。 它由多个标志位和特殊字符数组组成,用于控制终端的输入、输出、控制和本地模式。 MUSL: https://github.com/bminor/musl/blob/c47ad25ea3b484e10326f933e927c0bc8cded3da/arch/generic/bits/termios.h#L1

Fields§

§iflag: InputFlags

输入模式标志(Input modes),如是否启用回显、处理换行等

§oflag: OutputFlags

输出模式标志(Output modes),如是否自动添加换行符等

§cflag: u32

控制模式标志(Control modes),如波特率、字符长度、停止位、硬件流控制等

§lflag: LocalFlags

本地模式标志(Local modes),如是否启用 canonical 模式、信号生成等

§line: u8

行控制符,一般用于选择 cc 中的哪一个控制字符表示行结束符

§cc: [u8; 32]

终端特殊字符数组(Control characters),如中断键、结束符、擦除符等,大小通常为 NCCS(一般为 32)

§ispeed: u32

输入速度(Input speed),表示波特率

§ospeed: u32

输出速度(Output speed),表示波特率

Trait Implementations§

Source§

impl Clone for Termios

Source§

fn clone(&self) -> Termios

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Termios

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Termios

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for Termios

Auto Trait Implementations§

§

impl Freeze for Termios

§

impl RefUnwindSafe for Termios

§

impl Send for Termios

§

impl Sync for Termios

§

impl Unpin for Termios

§

impl UnwindSafe for Termios

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.