Struct FileReadTask

Source
pub struct FileReadTask { /* private fields */ }
Expand description

Handle to an asynchronous file reading operation.

Implementations§

Source§

impl FileReadTask

Source

pub fn new(file: FileHandle, task_id: u64, buffer: Box<[u8]>) -> FileReadTask

Creates a new FileReadTask with the task id differentiating different FileReadTasks. The platform implementation should create and keep track of these.

Source

pub fn file(&self) -> FileHandle

Returns the FileHandle this task is using.

Source

pub fn task_id(&self) -> u64

Returns the task id for this particular task, the same one passed into FileReadTask::new.

Source

pub fn read_size(&self) -> usize

Returns the size of the buffer, i.e. the amount of bytes read by this task.

Source

pub unsafe fn into_inner(self) -> Box<[u8]>

Deconstructs this into the inner buffer. Intended for platform layers implementing Platform::finish_file_read.

§Safety

The platform may have shared a pointer to this buffer with e.g. the kernel for async writing. The caller must ensure that when calling this function, such a shared pointer will not be used anymore, as this function makes said memory writable again (not owned and hidden in this struct).

Auto Trait Implementations§

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 = Infallible

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.