Skip to main content

RandomAccessDisk

Struct RandomAccessDisk 

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

Main constructor.

Implementations§

Source§

impl RandomAccessDisk

Source

pub async fn open( filename: impl AsRef<Path>, ) -> Result<RandomAccessDisk, RandomAccessError>

Create a new (auto-sync) instance to storage at filename.

Source

pub fn builder(filename: impl AsRef<Path>) -> Builder

Initialize a builder with storage at filename.

Trait Implementations§

Source§

impl Clone for RandomAccessDisk

Source§

fn clone(&self) -> RandomAccessDisk

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RandomAccessDisk

Source§

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

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

impl RandomAccess for RandomAccessDisk

Source§

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

Write bytes of data at an offset to the backend. Read more
Source§

fn read( &self, offset: u64, length: u64, ) -> BoxFuture<Result<Vec<u8>, RandomAccessError>>

Read a sequence of bytes at an offset from the backend. Read more
Source§

fn del( &self, offset: u64, length: u64, ) -> BoxFuture<Result<(), RandomAccessError>>

Delete a sequence of bytes of given length at an offset from the backend. This either sets the bytes in the given slice to zeroes, or if offset + length >= RandomAccess::len() is the same as truncate(offset). Read more
Source§

fn truncate(&self, length: u64) -> BoxFuture<Result<(), RandomAccessError>>

Resize the sequence of bytes so that RandomAccess::len() is set to length. If length < RandomAccess::len(), the bytes are disregarded. If length > RandomAccess::len(), the storage is zero-padded. Read more
Source§

fn len(&self) -> u64

Get the size of the storage in bytes.
Source§

fn sync_all(&self) -> BoxFuture<Result<(), RandomAccessError>>

Flush buffered data on the underlying storage resource. Read more
Source§

fn is_empty(&self) -> bool

Whether the storage is empty.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.