[][src]Trait gdbstub::Connection

pub trait Connection {
    type Error;
    fn read(&mut self) -> Result<u8, Self::Error>;
fn write(&mut self, byte: u8) -> Result<(), Self::Error>;
fn peek(&mut self) -> Result<Option<u8>, Self::Error>; fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> { ... } }

A trait to perform bytewise I/O over a serial transport layer.

Associated Types

type Error

Transport-specific error type.

Loading content...

Required methods

fn read(&mut self) -> Result<u8, Self::Error>

Read a single byte.

fn write(&mut self, byte: u8) -> Result<(), Self::Error>

Write a single byte.

fn peek(&mut self) -> Result<Option<u8>, Self::Error>

Peek a single byte. This should be a non-blocking operation (returning None if no byte is available).

Loading content...

Provided methods

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>

Read the exact number of bytes required to fill the buffer.

This method's default implementation calls self.read() for each byte in the buffer. This can be quite inefficient, so if a more efficient implementation exists (such as calling read_exact() on an underlying std::io::Read object), this method should be overwritten.

Loading content...

Trait Implementations

impl<E, '_> Connection for &'_ mut dyn Connection<Error = E>[src]

type Error = E

Transport-specific error type.

Implementations on Foreign Types

impl<E> Connection for Box<dyn Connection<Error = E>>[src]

type Error = E

impl Connection for TcpStream[src]

type Error = Error

impl Connection for UnixStream[src]

type Error = Error

Loading content...

Implementors

impl<E, '_> Connection for &'_ mut dyn Connection<Error = E>[src]

type Error = E

Loading content...