serial_core

Trait SerialPortSettings

Source
pub trait SerialPortSettings {
    // Required methods
    fn baud_rate(&self) -> Option<BaudRate>;
    fn char_size(&self) -> Option<CharSize>;
    fn parity(&self) -> Option<Parity>;
    fn stop_bits(&self) -> Option<StopBits>;
    fn flow_control(&self) -> Option<FlowControl>;
    fn set_baud_rate(&mut self, baud_rate: BaudRate) -> Result<()>;
    fn set_char_size(&mut self, char_size: CharSize);
    fn set_parity(&mut self, parity: Parity);
    fn set_stop_bits(&mut self, stop_bits: StopBits);
    fn set_flow_control(&mut self, flow_control: FlowControl);
}
Expand description

A trait for objects that implement serial port configurations.

Required Methods§

Source

fn baud_rate(&self) -> Option<BaudRate>

Returns the current baud rate.

This function returns None if the baud rate could not be determined. This may occur if the hardware is in an uninitialized state. Setting a baud rate with set_baud_rate() should initialize the baud rate to a supported value.

Source

fn char_size(&self) -> Option<CharSize>

Returns the character size.

This function returns None if the character size could not be determined. This may occur if the hardware is in an uninitialized state or is using a non-standard character size. Setting a baud rate with set_char_size() should initialize the character size to a supported value.

Source

fn parity(&self) -> Option<Parity>

Returns the parity-checking mode.

This function returns None if the parity mode could not be determined. This may occur if the hardware is in an uninitialized state or is using a non-standard parity mode. Setting a parity mode with set_parity() should initialize the parity mode to a supported value.

Source

fn stop_bits(&self) -> Option<StopBits>

Returns the number of stop bits.

This function returns None if the number of stop bits could not be determined. This may occur if the hardware is in an uninitialized state or is using an unsupported stop bit configuration. Setting the number of stop bits with set_stop-bits() should initialize the stop bits to a supported value.

Source

fn flow_control(&self) -> Option<FlowControl>

Returns the flow control mode.

This function returns None if the flow control mode could not be determined. This may occur if the hardware is in an uninitialized state or is using an unsupported flow control mode. Setting a flow control mode with set_flow_control() should initialize the flow control mode to a supported value.

Source

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

Sets the baud rate.

§Errors

If the implementation does not support the requested baud rate, this function may return an InvalidInput error. Even if the baud rate is accepted by set_baud_rate(), it may not be supported by the underlying hardware.

Source

fn set_char_size(&mut self, char_size: CharSize)

Sets the character size.

Source

fn set_parity(&mut self, parity: Parity)

Sets the parity-checking mode.

Source

fn set_stop_bits(&mut self, stop_bits: StopBits)

Sets the number of stop bits.

Source

fn set_flow_control(&mut self, flow_control: FlowControl)

Sets the flow control mode.

Implementors§