Trait ConnectionExt

Source
pub trait ConnectionExt: Connection {
    // Required methods
    fn read(&mut self) -> Result<u8, Self::Error>;
    fn peek(&mut self) -> Result<Option<u8>, Self::Error>;
}
Expand description

Extends Connection with read and peek methods.

This trait is used as part of gdbstub’s quickstart GdbStub::run_blocking API.

When the std feature is enabled, this trait is automatically implemented for TcpStream and UnixStream (on unix systems).

Required Methods§

Source

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

Read a single byte.

Source

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

Peek a single byte. This MUST be a non-blocking operation, returning None if no byte is available.

Returns a byte (if one is available) without removing that byte from the queue. Subsequent calls to peek MUST return the same byte.

Trait Implementations§

Source§

impl<E> Connection for &mut dyn ConnectionExt<Error = E>

Source§

type Error = E

Transport-specific error type.
Source§

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

Write a single byte.
Source§

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

Write the entire buffer, blocking until complete. Read more
Source§

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

Flush this Connection, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

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

Called at the start of a debugging session before any GDB packets have been sent/received. Read more
Source§

impl<E> Connection for Box<dyn ConnectionExt<Error = E>>

Source§

type Error = E

Transport-specific error type.
Source§

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

Write a single byte.
Source§

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

Write the entire buffer, blocking until complete. Read more
Source§

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

Flush this Connection, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

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

Called at the start of a debugging session before any GDB packets have been sent/received. Read more
Source§

impl<E> ConnectionExt for &mut dyn ConnectionExt<Error = E>

Source§

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

Read a single byte.
Source§

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

Peek a single byte. This MUST be a non-blocking operation, returning None if no byte is available. Read more
Source§

impl<E> ConnectionExt for Box<dyn ConnectionExt<Error = E>>

Source§

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

Read a single byte.
Source§

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

Peek a single byte. This MUST be a non-blocking operation, returning None if no byte is available. Read more

Implementations on Foreign Types§

Source§

impl ConnectionExt for TcpStream

Source§

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

Source§

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

Source§

impl ConnectionExt for UnixStream

Source§

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

Source§

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

Source§

impl<E> ConnectionExt for Box<dyn ConnectionExt<Error = E>>

Source§

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

Source§

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

Implementors§

Source§

impl<E> ConnectionExt for &mut dyn ConnectionExt<Error = E>