SocketAdapter

Trait SocketAdapter 

Source
pub trait SocketAdapter: Sized {
    type Setup;
    type Handle;

    // Required methods
    fn open(setup: Self::Setup) -> Result<Self::Handle, SocketError>;
    fn send(
        handle: &mut Self::Handle,
        buf: &[u8],
        timeout: u32,
    ) -> Result<usize, SocketError>;
    fn recv(
        handle: &mut Self::Handle,
        buf: &mut [u8],
        timeout: u32,
    ) -> Result<usize, SocketError>;
}
Expand description

A trait designed to accommodate various implementations of GP TEE Sockets API.

An implementation of this trait is responsible for handling all protocol-related tasks, including but not limited to:

  • Defining its own Setup type and using it to establish a new connection;
  • Sending and receiving data over the connection, while managing protocol errors (such as permitting certain warnings but raising others).

Required Associated Types§

Required Methods§

Source

fn open(setup: Self::Setup) -> Result<Self::Handle, SocketError>

Source

fn send( handle: &mut Self::Handle, buf: &[u8], timeout: u32, ) -> Result<usize, SocketError>

Source

fn recv( handle: &mut Self::Handle, buf: &mut [u8], timeout: u32, ) -> Result<usize, SocketError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§