pub struct FileStorage { /* private fields */ }Expand description
Simulates a flash storage using a host-based file.
This is usable for emulating authenticator hardware on VM hypervisor’s host OS.
Implementations§
Source§impl FileStorage
impl FileStorage
pub fn new(path: &Path, options: FileOptions) -> Result<FileStorage, Error>
Trait Implementations§
Source§impl Storage for FileStorage
impl Storage for FileStorage
Source§fn max_word_writes(&self) -> usize
fn max_word_writes(&self) -> usize
Maximum number of times a word can be written between page erasures.
Source§fn max_page_erases(&self) -> usize
fn max_page_erases(&self) -> usize
Maximum number of times a page can be erased.
Source§fn read_slice(
&self,
index: StorageIndex,
length: usize,
) -> Result<Cow<'_, [u8]>, Error>
fn read_slice( &self, index: StorageIndex, length: usize, ) -> Result<Cow<'_, [u8]>, Error>
Reads a byte slice from the storage. Read more
Source§fn write_slice(
&mut self,
index: StorageIndex,
value: &[u8],
) -> Result<(), Error>
fn write_slice( &mut self, index: StorageIndex, value: &[u8], ) -> Result<(), Error>
Writes a word slice to the storage. Read more
Auto Trait Implementations§
impl !Freeze for FileStorage
impl !RefUnwindSafe for FileStorage
impl Send for FileStorage
impl !Sync for FileStorage
impl Unpin for FileStorage
impl UnwindSafe for FileStorage
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