Trait serial_core::SerialPortSettings [] [src]

pub trait SerialPortSettings {
    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);
}

A trait for objects that implement serial port configurations.

Required Methods

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.

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.

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.

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.

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.

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.

Sets the character size.

Sets the parity-checking mode.

Sets the number of stop bits.

Sets the flow control mode.

Implementors