Struct Raw

Source
pub struct Raw<S: Storage + 'static> {
    inner: S,
    writable: bool,
    size: AtomicU64,
}
Expand description

Wraps a storage object without any translation.

Fields§

§inner: S

Wrapped storage object.

§writable: bool

Whether this image may be modified.

§size: AtomicU64

Disk size, which is the file size when this object was created.

Implementations§

Source§

impl<S: Storage + 'static> Raw<S>

Source

pub fn builder(image: S) -> RawOpenBuilder<S>

Create a new FormatDriverBuilder instance for the given image.

Source

pub fn builder_path<P: AsRef<Path>>(image_path: P) -> RawOpenBuilder<S>

Create a new FormatDriverBuilder instance for an image under the given path.

Source

pub fn create_builder(image: S) -> RawCreateBuilder<S>

Create a new FormatCreateBuilder instance for the given file.

Source

pub async fn open_image(inner: S, writable: bool) -> Result<Self>

Wrap inner, allowing it to be used as a disk image in raw format.

Source

pub async fn open_path<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>

Open the given path as a storage object, and wrap it in Raw.

Source

pub fn open_image_sync(inner: S, writable: bool) -> Result<Self>

Wrap inner, allowing it to be used as a disk image in raw format.

Source

pub fn open_path_sync<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>

Synchronous wrapper around Raw::open_path().

Trait Implementations§

Source§

impl<S: Debug + Storage + 'static> Debug for Raw<S>

Source§

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

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

impl<S: Storage + 'static> Display for Raw<S>

Source§

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

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

impl<S: Storage + 'static> FormatDriverInstance for Raw<S>

Source§

type Storage = S

Type of storage used.
Source§

fn format(&self) -> Format

Return which format this is.
Source§

unsafe fn probe<'life0, 'async_trait>( _storage: &'life0 S, ) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Check whether storage has this format. Read more
Source§

fn size(&self) -> u64

Size of the disk represented by this image.
Source§

fn zero_granularity(&self) -> Option<u64>

Granularity on which blocks can be marked as zero. Read more
Source§

fn collect_storage_dependencies(&self) -> Vec<&S>

Recursively collect all storage objects associated with this image. Read more
Source§

fn writable(&self) -> bool

Return whether this image may be modified. Read more
Source§

fn get_mapping<'a, 'async_trait>( &'a self, offset: u64, max_length: u64, ) -> Pin<Box<dyn Future<Output = Result<(ShallowMapping<'a, S>, u64)>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Return the mapping at offset. Read more
Source§

fn ensure_data_mapping<'a, 'async_trait>( &'a self, offset: u64, length: u64, _overwrite: bool, ) -> Pin<Box<dyn Future<Output = Result<(&'a S, u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Ensure that offset is directly mapped to some storage object, up to a length of length. Read more
Source§

fn ensure_zero_mapping<'life0, 'async_trait>( &'life0 self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ensure that the given range is efficiently mapped as zeroes. Read more
Source§

fn discard_to_zero<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, ensure it is read back as zeroes. Read more
Source§

fn discard_to_any<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range. Read more
Source§

fn discard_to_backing<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, such that the backing image becomes visible. Read more
Source§

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush internal buffers. Read more
Source§

fn sync<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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

unsafe fn invalidate_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drop internal buffers. Read more
Source§

fn resize_grow<'life0, 'async_trait>( &'life0 self, new_size: u64, format_prealloc_mode: PreallocateMode, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resize to the given size, which must be greater than the current size. Read more
Source§

fn resize_shrink<'life0, 'async_trait>( &'life0 mut self, new_size: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Truncate to the given size, which must be smaller than the current size. Read more
Source§

fn readv_special<'life0, 'life1, 'async_trait>( &'life0 self, _bufv: IoVectorMut<'life1>, _offset: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read data from a ShallowMapping::Special area.

Auto Trait Implementations§

§

impl<S> !Freeze for Raw<S>

§

impl<S> RefUnwindSafe for Raw<S>
where S: RefUnwindSafe,

§

impl<S> Send for Raw<S>

§

impl<S> Sync for Raw<S>

§

impl<S> Unpin for Raw<S>
where S: Unpin,

§

impl<S> UnwindSafe for Raw<S>
where S: 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.

§

impl<T> Instrument for T

§

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

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

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<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 = 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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