Termios

Struct Termios 

Source
#[repr(C)]
pub struct Termios { pub c_iflag: u32, pub c_oflag: u32, pub c_cflag: u32, pub c_lflag: u32, pub c_line: u8, pub c_cc: [u8; 19], pub c_ispeed: u32, pub c_ospeed: u32, }
Expand description

终端属性结构(用于 TCGETS/TCSETS)

这是 Linux asm-generic/termbits.h 中定义的标准 termios 结构。 RISC-V 架构使用 asm-generic 定义,NCCS=19。

内存布局:

  • offset 0-15: c_iflag, c_oflag, c_cflag, c_lflag (4 * u32 = 16 bytes)
  • offset 16: c_line (u8 = 1 byte)
  • offset 17-35: c_cc[19] (19 * u8 = 19 bytes)
  • offset 36-39: c_ispeed (u32 = 4 bytes, 对齐到4字节边界)
  • offset 40-43: c_ospeed (u32 = 4 bytes) 总大小:44字节

Fields§

§c_iflag: u32

输入模式标志

§c_oflag: u32

输出模式标志

§c_cflag: u32

控制模式标志

§c_lflag: u32

本地模式标志

§c_line: u8

行规程

§c_cc: [u8; 19]

特殊控制字符 [NCCS=19]

§c_ispeed: u32

输入波特率(注意:musl 在此之前有3字节padding使其对齐到4字节边界)

§c_ospeed: u32

输出波特率

Implementations§

Source§

impl Termios

Source

pub const DEFAULT: Self

默认终端配置常量

提供标准的终端默认设置,适用于交互式 shell 和一般终端应用。

Trait Implementations§

Source§

impl Clone for Termios

Source§

fn clone(&self) -> Termios

Returns a duplicate 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.