Skip to main content

Pooled

Struct Pooled 

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

A file whose batched reads go through a Pool.

Everything else is the file underneath, unchanged. read_at in particular stays synchronous on the calling thread, because handing one read to another thread and then blocking on it is two context switches to do what the caller was going to do anyway.

Implementations§

Source§

impl Pooled

Source

pub fn new(file: Box<dyn File>, pool: Pool) -> Self

Puts pool underneath file.

Source

pub fn pool(&self) -> &Pool

The pool this file reads through.

Trait Implementations§

Source§

impl Debug for Pooled

Source§

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

Formats the value using the given formatter. Read more
Source§

impl File for Pooled

Source§

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize>

Reads into buf starting at offset and returns how many bytes were read. Read more
Source§

fn submit(&self, requests: Vec<Request>) -> Completion

States every read the caller wants and hands back something to wait on or poll. Read more
Source§

fn write_at(&self, offset: u64, data: &[u8]) -> Result<()>

Writes all of data starting at offset, extending the file if it has to. Read more
Source§

fn sync(&self) -> Result<()>

Makes every write issued before this call durable. Read more
Source§

fn truncate(&self, len: u64) -> Result<()>

Cuts the file to len bytes, or extends it with zeroes. Read more
Source§

fn len(&self) -> Result<u64>

How many bytes long the file currently is. Read more
Source§

fn read_exact_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Reads exactly buf.len() bytes starting at offset. Read more
Source§

fn is_empty(&self) -> Result<bool>

Whether the file has no bytes in it. Read more

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

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.