pub struct FileLayout {
pub file_size: u64,
pub blocks: Vec<BlockInfo>,
pub gaps: Vec<GapInfo>,
}Expand description
Full layout of an MDF file.
Fields§
§file_size: u64§blocks: Vec<BlockInfo>Blocks sorted by offset.
gaps: Vec<GapInfo>Byte ranges inside the file that no visited block covered.
Implementations§
Source§impl FileLayout
impl FileLayout
Sourcepub fn from_file(path: &str) -> Result<Self, MdfError>
pub fn from_file(path: &str) -> Result<Self, MdfError>
Build a layout by reading an MDF file from disk into memory.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, MdfError>
pub fn from_bytes(data: &[u8]) -> Result<Self, MdfError>
Build a layout by walking an in-memory MDF image.
Sourcepub fn to_text(&self) -> String
pub fn to_text(&self) -> String
Render a flat, sorted listing followed by per-block link sections.
Sourcepub fn to_json(&self) -> Result<String, MdfError>
pub fn to_json(&self) -> Result<String, MdfError>
Serialize the layout to a pretty JSON string.
Sourcepub fn write_text_to_file(&self, path: &str) -> Result<(), MdfError>
pub fn write_text_to_file(&self, path: &str) -> Result<(), MdfError>
Write the text listing to path.
Trait Implementations§
Source§impl Clone for FileLayout
impl Clone for FileLayout
Source§impl Debug for FileLayout
impl Debug for FileLayout
Source§impl<'de> Deserialize<'de> for FileLayout
impl<'de> Deserialize<'de> for FileLayout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for FileLayout
impl Freeze for FileLayout
impl Move for FileLayout
impl RefUnwindSafe for FileLayout
impl Send for FileLayout
impl Sync for FileLayout
impl Unpin for FileLayout
impl UnsafeUnpin for FileLayout
impl UnwindSafe for FileLayout
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