[][src]Struct kio::Context

pub struct Context { /* fields omitted */ }

Implementations

impl Context[src]

pub fn new(uring: Uring, spawner: LocalSpawner) -> Self[src]

pub fn spawn<C, F>(&mut self, c: C) where
    C: FnOnce(Context) -> F,
    F: Future<Output = ()> + 'static, 
[src]

pub async fn accept(&mut self, socket: &mut TcpListener) -> Result<TcpStream>[src]

Accepts a new connection on the given listener.

pub fn buffer(&mut self, size: usize) -> Box<[u8]>[src]

Returns a buffer of at least the given size.

pub async fn connect<A>(&mut self, addr: A) -> Result<TcpStream> where
    A: ToSocketAddrs
[src]

pub fn listen<A>(&mut self, addr: A) -> Result<TcpListener> where
    A: ToSocketAddrs
[src]

Wrapper around net::TcpListener::bind.

pub async fn read(
    &mut self,
    stream: &mut TcpStream,
    buffer: &mut [u8]
) -> Result<usize>
[src]

Reads at least one byte into the buffer range and returns the size. If the stream is closed, returns zero.

pub async fn read_full(
    &mut self,
    stream: &mut TcpStream,
    buffer: &mut [u8]
) -> Result<usize>
[src]

Reads until the entire buffer range is populated or the stream is closed.

pub fn read_close(&self, stream: &mut TcpStream) -> Result<()>[src]

pub async fn write(
    &mut self,
    stream: &mut TcpStream,
    buffer: &[u8]
) -> Result<usize>
[src]

Writes at least one byte within the buffer range to the socket. Returns the amount written.

pub async fn write_then(
    &mut self,
    stream: &mut TcpStream,
    buffer: &[u8]
) -> Result<usize>
[src]

Writes at least one byte within the buffer range to the socket before running the next task. Returns the amount written.

pub async fn write_full(
    &mut self,
    stream: &mut TcpStream,
    buffer: &[u8]
) -> Result<()>
[src]

Writes the entire buffer range to the socket.

pub fn write_close(&self, stream: &mut TcpStream) -> Result<()>[src]

pub fn cancel(&mut self)[src]

Cancels all active tasks.

pub fn timeout(&mut self, _expires: Duration) -> Self[src]

Creates a new context that will be cancelled after the given duration.

Trait Implementations

impl Clone for Context[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.