[−][src]Struct tokio_serial::Serial
Serial port I/O struct.
Methods
impl Serial
[src]
pub fn from_path<P>(path: P, settings: &SerialPortSettings) -> Result<Serial> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Open serial port from a provided path, using the default reactor.
pub fn pair() -> Result<(Self, Self)>
[src]
Create a pair of pseudo serial terminals using the default reactor
Returns
Two connected, unnamed Serial
objects.
Errors
Attempting any IO or parameter settings on the slave tty after the master tty is closed will return errors.
pub fn set_exclusive(&mut self, exclusive: bool) -> Result<()>
[src]
Sets the exclusivity of the port
If a port is exclusive, then trying to open the same device path again will fail.
See the man pages for the tiocexcl and tiocnxcl ioctl's for more details.
Errors
Io
for any error while setting exclusivity for the port.
pub fn exclusive(&self) -> bool
[src]
Returns the exclusivity of the port
If a port is exclusive, then trying to open the same device path again will fail.
Trait Implementations
impl Read for Serial
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut]) -> Result<usize, Error>
1.36.0[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Write for Serial
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
impl AsRawFd for Serial
[src]
impl SerialPort for Serial
[src]
fn settings(&self) -> SerialPortSettings
[src]
fn name(&self) -> Option<String>
[src]
fn baud_rate(&self) -> Result<u32>
[src]
fn data_bits(&self) -> Result<DataBits>
[src]
fn flow_control(&self) -> Result<FlowControl>
[src]
fn parity(&self) -> Result<Parity>
[src]
fn stop_bits(&self) -> Result<StopBits>
[src]
fn timeout(&self) -> Duration
[src]
fn set_all(&mut self, settings: &SerialPortSettings) -> Result<()>
[src]
fn set_baud_rate(&mut self, baud_rate: u32) -> Result<()>
[src]
fn set_data_bits(&mut self, data_bits: DataBits) -> Result<()>
[src]
fn set_flow_control(&mut self, flow_control: FlowControl) -> Result<()>
[src]
fn set_parity(&mut self, parity: Parity) -> Result<()>
[src]
fn set_stop_bits(&mut self, stop_bits: StopBits) -> Result<()>
[src]
fn set_timeout(&mut self, _: Duration) -> Result<()>
[src]
fn write_request_to_send(&mut self, level: bool) -> Result<()>
[src]
fn write_data_terminal_ready(&mut self, level: bool) -> Result<()>
[src]
fn read_clear_to_send(&mut self) -> Result<bool>
[src]
fn read_data_set_ready(&mut self) -> Result<bool>
[src]
fn read_ring_indicator(&mut self) -> Result<bool>
[src]
fn read_carrier_detect(&mut self) -> Result<bool>
[src]
fn bytes_to_read(&self) -> Result<u32>
[src]
fn bytes_to_write(&self) -> Result<u32>
[src]
fn clear(&self, buffer_to_clear: ClearBuffer) -> Result<()>
[src]
fn try_clone(&self) -> Result<Box<dyn SerialPort>>
[src]
impl AsyncRead for Serial
[src]
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
unsafe fn prepare_uninitialized_buffer(
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
[src]
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
fn poll_read_buf<B>(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
impl AsyncWrite for Serial
[src]
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_write_buf<B>(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
Auto Trait Implementations
impl Send for Serial
impl Sync for Serial
impl Unpin for Serial
impl !UnwindSafe for Serial
impl !RefUnwindSafe for Serial
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,