[−][src]Struct kio::Context
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]
C: FnOnce(Context) -> F,
F: Future<Output = ()> + 'static,
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]
A: ToSocketAddrs,
pub fn listen<A>(&mut self, addr: A) -> Result<TcpListener> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Wrapper around net::TcpListener::bind.
pub async fn read(
&mut self,
stream: &mut TcpStream,
buffer: &mut [u8]
) -> Result<usize>
[src]
&mut self,
stream: &mut TcpStream,
buffer: &mut [u8]
) -> Result<usize>
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]
&mut self,
stream: &mut TcpStream,
buffer: &mut [u8]
) -> Result<usize>
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]
&mut self,
stream: &mut TcpStream,
buffer: &[u8]
) -> Result<usize>
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]
&mut self,
stream: &mut TcpStream,
buffer: &[u8]
) -> Result<usize>
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]
&mut self,
stream: &mut TcpStream,
buffer: &[u8]
) -> Result<()>
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
Auto Trait Implementations
impl !RefUnwindSafe for Context
[src]
impl !Send for Context
[src]
impl !Sync for Context
[src]
impl Unpin for Context
[src]
impl !UnwindSafe for Context
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut 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.
pub 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>,