Struct ferrous_serialport::COMPort[][src]

pub struct COMPort { /* fields omitted */ }

A serial port implementation for Windows COM ports

The port will be closed when the value is dropped. However, this struct should not be instantiated directly by using COMPort::open(), instead use the cross-platform serialport::open() or serialport::open_with_settings().

Implementations

impl COMPort[src]

pub fn open(builder: &SerialPortBuilder) -> Result<COMPort>[src]

Opens a COM port as a serial device.

port should be the name of a COM port, e.g., COM1.

If the COM port handle needs to be opened with special flags, use from_raw_handle method to create the COMPort. Note that you should set the different settings before using the serial port using set_all.

Errors

  • NoDevice if the device could not be opened. This could indicate that the device is already in use.
  • InvalidInput if port is not a valid device name.
  • Io for any other I/O error while opening or initializing the device.

pub fn try_clone_native(&self) -> Result<COMPort>[src]

Attempts to clone the SerialPort. This allow you to write and read simultaneously from the same serial connection. Please note that if you want a real asynchronous serial port you should look at mio-serial or tokio-serial.

Also, you must be very careful when changing the settings of a cloned SerialPort : since the settings are cached on a per object basis, trying to modify them from two different objects can cause some nasty behavior.

This is the same as SerialPort::try_clone() but returns the concrete type instead.

Errors

This function returns an error if the serial port couldn’t be cloned.

Trait Implementations

impl AsRawHandle for COMPort[src]

impl Debug for COMPort[src]

impl Drop for COMPort[src]

impl FromRawHandle for COMPort[src]

impl Read for COMPort[src]

impl Send for COMPort[src]

impl SerialPort for COMPort[src]

impl Write for COMPort[src]

Auto Trait Implementations

impl RefUnwindSafe for COMPort

impl !Sync for COMPort

impl Unpin for COMPort

impl UnwindSafe for COMPort

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.