Struct serial2::Settings

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

The settings of a serial port.

Implementations§

source§

impl Settings

source

pub fn set_raw(&mut self)

Disable all OS level input and output processing.

All input and output processing will be disabled, and the configuration will be set for 8 bit binary communication, one stop bit, no parity checks and no flow control.

This is usually a good starting point for manual configuration.

source

pub fn set_baud_rate(&mut self, baud_rate: u32) -> Result<()>

Set the baud rate to be configured.

This function returns an error if the platform does not support the requested bandwidth. Note that the device itself may also not support the requested baud rate, even if the platform does. In that case SerialPort::set_configuration() will return an error.

source

pub fn get_baud_rate(&self) -> Result<u32>

Get the baud rate from the configuration.

source

pub fn set_char_size(&mut self, char_size: CharSize)

Set the number of bits in a character.

source

pub fn get_char_size(&self) -> Result<CharSize>

Get the number of bits in a character.

source

pub fn set_stop_bits(&mut self, stop_bits: StopBits)

Set the number of stop bits following each character.

source

pub fn get_stop_bits(&self) -> Result<StopBits>

Get the number of stop bits following each character.

source

pub fn set_parity(&mut self, parity: Parity)

Set the partity check.

source

pub fn get_parity(&self) -> Result<Parity>

Get the partity check.

source

pub fn set_flow_control(&mut self, flow_control: FlowControl)

Set the flow control mechanism.

See the individual documentation of the FlowControl variants for more information.

source

pub fn get_flow_control(&self) -> Result<FlowControl>

Get the flow control mechanism

source

pub fn as_termios(&self) -> &RawTermios

Available on crate feature unix only.

Get a reference to the raw termios struct.

On Linux and Android this is actually a termios2 struct. On other Unix platforms, this is a termios struct.

You can use this function to access Unix specific features of the serial port. Your code will not be cross-platform anymore if you use this.

source

pub fn as_termios_mut(&mut self) -> &mut RawTermios

Available on crate feature unix only.

Get a mutable reference to the raw termios struct.

On Linux and Android this is actually a termios2 struct. On other Unix platforms, this is a termios struct.

You can use this function to access Unix specific features of the serial port. Your code will not be cross-platform anymore if you use this.

source

pub fn as_raw_dbc(&self) -> &DCB

Available on crate feature windows only.

Get a reference to the raw DCB struct.

You can use this function to access Windows specific features of the serial port. Your code will not be cross-platform anymore if you use this.

source

pub fn as_raw_dbc_mut(&mut self) -> &mut DCB

Available on crate feature windows only.

Get a mutable reference to the raw DCB struct.

You can use this function to access Windows specific features of the serial port. Your code will not be cross-platform anymore if you use this.

Trait Implementations§

source§

impl Clone for Settings

source§

fn clone(&self) -> Settings

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Settings

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T, U> TryFrom<U> for T
where 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 T
where 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.