Skip to main content

BorrowedReadHalf

Struct BorrowedReadHalf 

Source
pub struct BorrowedReadHalf<'s, 'sel, const FDS: usize> { /* private fields */ }
Expand description

Read half of a TCP/Unix stream.

Implementations§

Source§

impl<'s, 'sel, const FDS: usize> BorrowedReadHalf<'s, 'sel, FDS>

Source

pub async fn readable(&mut self)

Waits until the stream is readable.

The stream may still turn out to be not readable, so try_read can return Errno::AGAIN after it.

§Cancel safety

This method is cancel safe.

Source

pub fn try_read(&self, buf: &mut [u8]) -> Result<usize>

Reads into a given buffer without waiting, returns the number of read bytes.

Returns 0 if the stream is closed (or if the buffer is empty).

§Errors

Returns Errno::AGAIN if the stream is not readable, or an error if the syscall fails.

Trait Implementations§

Source§

impl<const FDS: usize> AsyncRead for BorrowedReadHalf<'_, '_, FDS>

Source§

type Error = NetError

The error returned by read.
Source§

fn read<'a>( &'a mut self, buf: &'a mut [u8], ) -> impl Future<Output = Result<usize, NetError>>

Reads into a given buffer, returns the number of read bytes. Read more

Auto Trait Implementations§

§

impl<'s, 'sel, const FDS: usize> !RefUnwindSafe for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> !Send for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> !Sync for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> !UnwindSafe for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> Forget for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> Freeze for BorrowedReadHalf<'s, 'sel, FDS>
where &'s Socket<'sel, FDS>: Freeze,

§

impl<'s, 'sel, const FDS: usize> Move for BorrowedReadHalf<'s, 'sel, FDS>

§

impl<'s, 'sel, const FDS: usize> Unpin for BorrowedReadHalf<'s, 'sel, FDS>
where &'s Socket<'sel, FDS>: Unpin,

§

impl<'s, 'sel, const FDS: usize> UnsafeUnpin for BorrowedReadHalf<'s, 'sel, FDS>
where &'s Socket<'sel, FDS>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsyncReadExt for T
where T: AsyncRead + ?Sized,

Source§

fn read_exact<'a>( &'a mut self, buf: &'a mut [u8], ) -> impl Future<Output = Result<(), ReadExactError<Self::Error>>>

Fills the whole given buffer, calling AsyncRead::read until it’s done. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.