Struct disk::android_sparse::AndroidSparse
source · pub struct AndroidSparse {
file: File,
total_size: u64,
chunks: BTreeMap<u64, ChunkWithSize>,
}
Fields§
§file: File
§total_size: u64
§chunks: BTreeMap<u64, ChunkWithSize>
Implementations§
source§impl AndroidSparse
impl AndroidSparse
pub fn from_file(file: File) -> Result<AndroidSparse, Error>
fn from_parts( file: File, size: u64, chunks: Vec<ChunkWithSize> ) -> Result<AndroidSparse, Error>
Trait Implementations§
source§impl AsRawDescriptor for AndroidSparse
impl AsRawDescriptor for AndroidSparse
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
source§impl Debug for AndroidSparse
impl Debug for AndroidSparse
source§impl DiskFile for AndroidSparse
impl DiskFile for AndroidSparse
source§impl DiskGetLen for AndroidSparse
impl DiskGetLen for AndroidSparse
source§impl FileReadWriteAtVolatile for AndroidSparse
impl FileReadWriteAtVolatile for AndroidSparse
source§fn read_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<usize>
fn read_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<usize>
Reads bytes from this file at
offset
into the given slice, returning the number of bytes
read on success. On Windows file pointer will update with the read, but on Linux the
file pointer will not change.source§fn write_at_volatile(
&self,
_slice: VolatileSlice<'_>,
_offset: u64
) -> Result<usize>
fn write_at_volatile( &self, _slice: VolatileSlice<'_>, _offset: u64 ) -> Result<usize>
Writes bytes to this file at
offset
from the given slice, returning the number of bytes
written on success. On Windows file pointer will update with the write, but on Linux the
file pointer will not change.§fn read_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize, Error>
fn read_vectored_at_volatile( &self, bufs: &[VolatileSlice<'_>], offset: u64 ) -> Result<usize, Error>
Like
read_at_volatile
, except it reads to a slice of buffers. Data is copied to fill each
buffer in order, with the final buffer written to possibly being only partially filled. This
method must behave as a single call to read_at_volatile
with the buffers concatenated
would. The default implementation calls read_at_volatile
with either the first nonempty
buffer provided, or returns Ok(0)
if none exists.
On Windows file pointer will update with the read, but on Linux the file pointer will not
change.§fn read_exact_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<(), Error>
fn read_exact_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<(), Error>
Reads bytes from this file at
offset
into the given slice until all bytes in the slice are
read, or an error is returned. On Windows file pointer will update with the read, but on
Linux the file pointer will not change.§fn write_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize, Error>
fn write_vectored_at_volatile( &self, bufs: &[VolatileSlice<'_>], offset: u64 ) -> Result<usize, Error>
Like
write_at_volatile
, except that it writes from a slice of buffers. Data is copied
from each buffer in order, with the final buffer read from possibly being only partially
consumed. This method must behave as a call to write_at_volatile
with the buffers
concatenated would. The default implementation calls write_at_volatile
with either the
first nonempty buffer provided, or returns Ok(0)
if none exists.
On Windows file pointer will update with the write, but on Linux the file pointer will not
change.§fn write_all_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<(), Error>
fn write_all_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<(), Error>
Writes bytes to this file at
offset
from the given slice until all bytes in the slice
are written, or an error is returned. On Windows file pointer will update with the write,
but on Linux the file pointer will not change.source§impl ToAsyncDisk for AndroidSparse
impl ToAsyncDisk for AndroidSparse
source§fn to_async_disk(
self: Box<Self>,
ex: &Executor
) -> DiskResult<Box<dyn AsyncDisk>>
fn to_async_disk( self: Box<Self>, ex: &Executor ) -> DiskResult<Box<dyn AsyncDisk>>
Convert a boxed self in to a box-wrapped implementaiton of AsyncDisk.
Used to convert a standard disk image to an async disk image. This conversion and the
inverse are needed so that the
Send
DiskImage can be given to the block thread where it is
converted to a non-Send
AsyncDisk. The AsyncDisk can then be converted back and returned
to the main device thread if the block device is destroyed or reset.Auto Trait Implementations§
impl RefUnwindSafe for AndroidSparse
impl Send for AndroidSparse
impl Sync for AndroidSparse
impl Unpin for AndroidSparse
impl UnwindSafe for AndroidSparse
Blanket Implementations§
§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
§fn as_raw_descriptors(&self) -> Vec<i32>
fn as_raw_descriptors(&self) -> Vec<i32>
Returns the underlying raw descriptors. Read more
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