Struct tokio_serial::Serial [] [src]

pub struct Serial { /* fields omitted */ }

Serial port I/O struct.

Methods

impl Serial
[src]

Open serial port from a provided path.

Test whether this serial port is ready to be read or not.

If the serial port is not readable then the current task is scheduled to get a notification when the socket does become readable. That is, this is only suitable for calling in a Future::poll method and will automatically handle ensuring a retry once the socket is readable again.

Test whether this socket is ready to be written to or not.

If the socket is not writable then the current task is scheduled to get a notification when the socket does become writable. That is, this is only suitable for calling in a Future::poll method and will automatically handle ensuring a retry once the socket is writable again.

Trait Implementations

impl SerialPort for Serial
[src]

Returns a struct with the current port settings

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 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.

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 current timeout.

Applies all settings for a struct. This isn't guaranteed to involve only a single call into the driver, though that may be done on some platforms.

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 flow control mode.

Sets the parity-checking mode.

Sets the number of stop bits.

Sets the timeout for future I/O operations. This parameter is ignored but required for trait completeness.

Sets the state of the RTS (Request To Send) control signal.

Setting a value of true asserts the RTS control signal. false clears the signal.

Errors

This function returns an error if the RTS control signal could not be set to the desired state on the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

Writes to the Data Terminal Ready pin

Setting a value of true asserts the DTR control signal. false clears the signal.

Errors

This function returns an error if the DTR control signal could not be set to the desired state on the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

Reads the state of the CTS (Clear To Send) control signal.

This function returns a boolean that indicates whether the CTS control signal is asserted.

Errors

This function returns an error if the state of the CTS control signal could not be read from the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

Reads the state of the Data Set Ready control signal.

This function returns a boolean that indicates whether the DSR control signal is asserted.

Errors

This function returns an error if the state of the DSR control signal could not be read from the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

Reads the state of the Ring Indicator control signal.

This function returns a boolean that indicates whether the RI control signal is asserted.

Errors

This function returns an error if the state of the RI control signal could not be read from the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

Reads the state of the Carrier Detect control signal.

This function returns a boolean that indicates whether the CD control signal is asserted.

Errors

This function returns an error if the state of the CD control signal could not be read from the underlying hardware:

  • NoDevice if the device was disconnected.
  • Io for any other type of I/O error.

impl Read for Serial
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

🔬 This is a nightly-only experimental API.   (io)

the semantics of a partial read/write of where errors happen is currently unclear and may change

Transforms this Read instance to an Iterator over chars. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

impl Write for Serial
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl Io for Serial
[src]

Tests to see if this I/O object may be readable. Read more

Tests to see if this I/O object may be writable. Read more

Provides a Stream and Sink interface for reading and writing to this Io object, using Decode and Encode to read and write the raw data. Read more

Helper method for splitting this read/write object into two halves. Read more

impl<'a> Read for &'a Serial
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

🔬 This is a nightly-only experimental API.   (io)

the semantics of a partial read/write of where errors happen is currently unclear and may change

Transforms this Read instance to an Iterator over chars. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

impl<'a> Write for &'a Serial
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl<'a> Io for &'a Serial
[src]

Tests to see if this I/O object may be readable. Read more

Tests to see if this I/O object may be writable. Read more

Provides a Stream and Sink interface for reading and writing to this Io object, using Decode and Encode to read and write the raw data. Read more

Helper method for splitting this read/write object into two halves. Read more

impl AsRawFd for Serial
[src]

Extracts the raw file descriptor. Read more