Skip to main content

Null

Struct Null 

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

Null storage object.

Reading from this will always return zeroes, writing to it does nothing (except to potentially grow its virtual “file length”).

Implementations§

Source§

impl Null

Source

pub fn new(size: u64) -> Self

Create a new null storage object with the given initial virtual size.

Trait Implementations§

Source§

impl Debug for Null

Source§

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

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

impl Display for Null

Source§

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

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

impl Storage for Null

Source§

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

Storage object length.
Source§

async unsafe fn pure_readv( &self, bufv: IoVectorMut<'_>, _offset: u64, ) -> Result<()>

Read data at offset into bufv. Read more
Source§

async unsafe fn pure_writev( &self, bufv: IoVector<'_>, offset: u64, ) -> Result<()>

Write data from bufv to offset. Read more
Source§

async unsafe fn pure_write_zeroes(&self, offset: u64, length: u64) -> Result<()>

Ensure the given range reads back as zeroes. Read more
Source§

async fn flush(&self) -> Result<()>

Flush internal buffers. Read more
Source§

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

Sync data already written to the storage hardware. Read more
Source§

async unsafe fn invalidate_cache(&self) -> Result<()>

Drop internal buffers. Read more
Source§

fn get_storage_helper(&self) -> &CommonStorageHelper

Return the storage helper object (used by the StorageExt implementation).
Source§

async fn resize( &self, new_size: u64, _prealloc_mode: PreallocateMode, ) -> Result<()>

Resize to the given size. Read more
Source§

async fn open(_opts: StorageOpenOptions) -> Result<Self>

Open a storage object. Read more
Source§

fn open_sync(opts: StorageOpenOptions) -> Result<Self>

Available on crate feature sync-wrappers only.
Synchronous wrapper around Storage::open().
Source§

async fn create_open(_opts: StorageCreateOptions) -> Result<Self>

Create a storage object and open it. Read more
Source§

async fn create(opts: StorageCreateOptions) -> Result<()>

Create a storage object. Read more
Source§

fn mem_align(&self) -> usize

Minimum required alignment for memory buffers.
Source§

fn req_align(&self) -> usize

Minimum required alignment for offsets and lengths.
Source§

fn zero_align(&self) -> usize

Minimum required alignment for zero writes.
Source§

fn discard_align(&self) -> usize

Minimum required alignment for effective discards.
Source§

fn resolve_relative_path<P: AsRef<Path>>(&self, _relative: P) -> Result<PathBuf>

Resolve the given path relative to this storage object. Read more
Source§

fn get_filename(&self) -> Option<PathBuf>

Return a filename, if possible. Read more
Source§

async unsafe fn pure_write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Result<()>

Ensure the given range is allocated, and reads back as zeroes. Read more
Source§

async unsafe fn pure_discard(&self, _offset: u64, _length: u64) -> Result<()>

Discard the given range, with undefined contents when read back. Read more

Auto Trait Implementations§

§

impl !Freeze for Null

§

impl RefUnwindSafe for Null

§

impl Send for Null

§

impl Sync for Null

§

impl Unpin for Null

§

impl UnsafeUnpin for Null

§

impl UnwindSafe for Null

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<S> DynStorage for S
where S: Storage + 'static,

Source§

fn dyn_mem_align(&self) -> usize

Wrapper around Storage::mem_align().
Source§

fn dyn_req_align(&self) -> usize

Wrapper around Storage::req_align().
Source§

fn dyn_zero_align(&self) -> usize

Wrapper around Storage::zero_align().
Source§

fn dyn_discard_align(&self) -> usize

Wrapper around Storage::discard_align().
Source§

fn dyn_size(&self) -> Result<u64, Error>

Wrapper around Storage::size().
Source§

fn dyn_resolve_relative_path(&self, relative: &Path) -> Result<PathBuf, Error>

Source§

fn dyn_get_filename(&self) -> Option<PathBuf>

Source§

unsafe fn dyn_pure_readv<'a>( &'a self, bufv: IoVectorMut<'a>, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>

Object-safe wrapper around Storage::pure_readv(). Read more
Source§

unsafe fn dyn_pure_writev<'a>( &'a self, bufv: IoVector<'a>, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>

Object-safe wrapper around Storage::pure_writev(). Read more
Source§

unsafe fn dyn_pure_write_zeroes( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Object-safe wrapper around Storage::pure_write_zeroes(). Read more
Source§

unsafe fn dyn_pure_write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Source§

unsafe fn dyn_pure_discard( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Object-safe wrapper around Storage::pure_discard(). Read more
Source§

fn dyn_flush(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Object-safe wrapper around Storage::flush().
Source§

fn dyn_sync(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Object-safe wrapper around Storage::sync().
Source§

unsafe fn dyn_invalidate_cache( &self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Object-safe wrapper around Storage::invalidate_cache(). Read more
Source§

fn dyn_get_storage_helper(&self) -> &CommonStorageHelper

Source§

fn dyn_resize( &self, new_size: u64, prealloc_mode: PreallocateMode, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>

Wrapper around Storage::resize().
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<S> StorageExt for S
where S: Storage,

Source§

async fn readv(&self, bufv: IoVectorMut<'_>, offset: u64) -> Result<(), Error>

Read data at offset into bufv. Read more
Source§

async fn writev(&self, bufv: IoVector<'_>, offset: u64) -> Result<(), Error>

Write data from bufv to offset. Read more
Source§

async fn read( &self, buf: impl Into<IoVectorMut<'_>>, offset: u64, ) -> Result<(), Error>

Read data at offset into buf. Read more
Source§

async fn write( &self, buf: impl Into<IoVector<'_>>, offset: u64, ) -> Result<(), Error>

Write data from buf to offset. Read more
Source§

async fn write_zeroes(&self, offset: u64, length: u64) -> Result<(), Error>

Ensure the given range reads back as zeroes.
Source§

async fn write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Result<(), Error>

Ensure the given range is allocated and reads back as zeroes.
Source§

async fn discard(&self, offset: u64, length: u64) -> Result<(), Error>

Discard the given range, with undefined contents when read back. Read more
Source§

async fn weak_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>

Await concurrent strong write blockers for the given range. Read more
Source§

async fn strong_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>

Await any concurrent write request for the given range. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more