Struct tty::LineDiscipline

source ·
pub struct LineDiscipline { /* private fields */ }
Expand description

A TTY line discipline.

The line discipline can be configured based on what application is using the slave end. Most applications should use the sane setting, which handles line editing and echoing to the terminal. Applications that require more control over the display should use the raw setting.

The line discipline’s behaviour is documented in terms of Linux termios flags. For more information, visit the cfmakeraw documentation.

The line discipline prepends a carriage return to all line feeds on output. This behaviour is equivalent to ONLCR on Linux.

Implementations§

source§

impl LineDiscipline

source

pub fn new() -> Self

Creates a new line discipline with sane defaults.

source

pub fn set_sane(&self)

Resets the line discipline to sane defaults.

This is equivalent to:

discipline.set_echo(true);
discipline.set_canonical(true);
source

pub fn set_raw(&self)

Sets the line discipline to raw mode.

This is equivalent to:

discipline.set_echo(false);
discipline.set_canonical(false);
source

pub fn echo(&self) -> bool

source

pub fn set_echo(&self, echo: bool)

Sets the echo flag.

This is equivalent to ECHO | ECHOE | ECHOCTL on Linux.

source

pub fn canonical(&self) -> bool

Sets the line discipline to canonical mode.

This is equivalent to ICANON | ICRNL on Linux.

source

pub fn event_receiver(&self) -> Receiver<Event>

source

pub fn clear_events(&self)

source

pub fn set_canonical(&self, canonical: bool)

Sets the canonical flag.

This is equivalent to ICANON on Linux.

Trait Implementations§

source§

impl Default for LineDiscipline

source§

fn default() -> Self

Equivalent to Self::new.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.