Skip to main content

FileIo

Struct FileIo 

Source
pub struct FileIo<B> { /* private fields */ }
Expand description

A pending file operation submitted through AssociatedEndpoint::read or AssociatedEndpoint::write.

The token carries the operation’s identity and remembers the buffer type it was submitted with, so FileIo::claim hands back the caller’s own buffer – the same value, not a copy – once the matching completion is dequeued.

Implementations§

Source§

impl<B: IoBuf> FileIo<B>

Source

pub fn id(&self) -> OperationId

The identity of the in-flight operation, for cancellation or matching.

Source

pub fn claim(self, completion: &Completion) -> Result<(B, Result<usize>), Self>

Claim this operation’s result from completion.

On a match returns Ok((buffer, result)): buffer is the one the caller handed over – the bytes read, or the data written – and result is the byte count or the operation’s error. Returns Err(self) when completion belongs to a different operation, so the caller can try the token against another one.

Trait Implementations§

Source§

impl<B: Debug> Debug for FileIo<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B> Freeze for FileIo<B>
where PhantomData<fn() -> B>: Freeze,

§

impl<B> RefUnwindSafe for FileIo<B>
where PhantomData<fn() -> B>: RefUnwindSafe,

§

impl<B> Send for FileIo<B>
where PhantomData<fn() -> B>: Send,

§

impl<B> Sync for FileIo<B>
where PhantomData<fn() -> B>: Sync,

§

impl<B> Unpin for FileIo<B>
where PhantomData<fn() -> B>: Unpin,

§

impl<B> UnsafeUnpin for FileIo<B>
where PhantomData<fn() -> B>: UnsafeUnpin,

§

impl<B> UnwindSafe for FileIo<B>
where PhantomData<fn() -> B>: UnwindSafe,

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> 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, <T as TryFrom<U>>::Error>

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.