pub struct StorageCreateOptions {
pub(crate) open_opts: StorageOpenOptions,
pub(crate) size: u64,
pub(crate) prealloc_mode: PreallocateMode,
pub(crate) overwrite: bool,
}
Expand description
Parameters from which a new storage object can be created.
Fields§
§open_opts: StorageOpenOptions
Options to open the image, includes the filename.
writable
should be ignored, created files should always be opened as writable.
size: u64
Initial size.
prealloc_mode: PreallocateMode
Preallocation mode.
overwrite: bool
Whether to overwrite an existing file.
Implementations§
Source§impl StorageCreateOptions
impl StorageCreateOptions
Sourcepub fn filename<P: AsRef<Path>>(self, filename: P) -> Self
pub fn filename<P: AsRef<Path>>(self, filename: P) -> Self
Set the filename of the file to create.
Sourcepub fn preallocate(self, prealloc_mode: PreallocateMode) -> Self
pub fn preallocate(self, prealloc_mode: PreallocateMode) -> Self
Set the desired preallocation mode.
Sourcepub fn modify_open_opts<F: FnOnce(StorageOpenOptions) -> StorageOpenOptions>(
self,
f: F,
) -> Self
pub fn modify_open_opts<F: FnOnce(StorageOpenOptions) -> StorageOpenOptions>( self, f: F, ) -> Self
Modify the options used for opening the file.
Sourcepub fn get_filename(&self) -> Option<&Path>
pub fn get_filename(&self) -> Option<&Path>
Get the set filename (if any).
Sourcepub fn get_preallocate(&self) -> PreallocateMode
pub fn get_preallocate(&self) -> PreallocateMode
Get the preallocation mode.
Sourcepub fn get_overwrite(&self) -> bool
pub fn get_overwrite(&self) -> bool
Check whether to overwrite an existing file.
Sourcepub fn get_open_options(self) -> StorageOpenOptions
pub fn get_open_options(self) -> StorageOpenOptions
Get the options for opening the created file.
Trait Implementations§
Source§impl Clone for StorageCreateOptions
impl Clone for StorageCreateOptions
Source§fn clone(&self) -> StorageCreateOptions
fn clone(&self) -> StorageCreateOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StorageCreateOptions
impl Debug for StorageCreateOptions
Auto Trait Implementations§
impl Freeze for StorageCreateOptions
impl RefUnwindSafe for StorageCreateOptions
impl Send for StorageCreateOptions
impl Sync for StorageCreateOptions
impl Unpin for StorageCreateOptions
impl UnwindSafe for StorageCreateOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more