Struct ADF

Source
pub struct ADF {
    pub data: Vec<u8>,
    pub bitmap: Vec<bool>,
}

Fields§

§data: Vec<u8>§bitmap: Vec<bool>

Implementations§

Source§

impl ADF

Source

pub fn new(size: usize, block_size: usize) -> Self

Source

pub fn extract_metadata(&self) -> Result<ADFMetadata>

Source

pub fn format(&mut self, disk_type: DiskType, disk_name: &str) -> Result<()>

Source

pub fn extract_file(&self, file_name: &str) -> Result<ExtractedFile>

Source

pub fn from_bytes(data: &[u8]) -> Result<Self>

Source

pub fn from_file(path: &str) -> Result<ADF>

Source

pub fn get_bitmap(&self) -> &[bool]

Source

pub fn get_bitmap_info(&self) -> BitmapInfo

Source

pub fn get_block_status(&self, block_index: usize) -> Option<bool>

Source

pub fn set_block_status( &mut self, block_index: usize, status: bool, ) -> Result<()>

Source

pub fn defragment(&mut self) -> Result<()>

Source

pub fn get_fragmentation_score(&self) -> usize

Source

pub fn write_to_file(&self, path: &str) -> Result<()>

Source

pub fn find_contiguous_free_blocks(&self, count: usize) -> Option<usize>

Source

pub fn read_sector(&self, sector: usize) -> &[u8]

Source

pub fn write_sector(&mut self, sector: usize, data: &[u8]) -> Result<()>

Source

pub fn read_boot_block(&self) -> &[u8]

Source

pub fn read_root_block(&self) -> &[u8]

Source

pub fn list_root_directory(&self) -> Result<Vec<FileInfo>>

Source

pub fn list_directory( &self, block: usize, ) -> impl Iterator<Item = Result<FileInfo>> + '_

Source

pub fn format_protection_flags(&self, flags: u32) -> String

Source

pub fn calculate_checksum(&self, data: &[u8]) -> u32

Source

pub fn set_block_used(&mut self, block_index: usize)

Source

pub fn set_block_free(&mut self, block_index: usize)

Source

pub fn update_bitmap_blocks(&mut self) -> Result<()>

Source

pub fn initialize_bitmap(&mut self) -> Result<()>

Source

pub fn allocate_block(&mut self) -> Result<usize>

Source

pub fn find_free_block(&self) -> Option<usize>

Source

pub fn read_file_contents(&self, block: usize) -> Result<Vec<u8>>

Source

pub fn information(&self) -> Result<DiskInfo>

Source

pub fn list(&self) -> Result<String>

Source

pub fn to_json(&self) -> Result<String>

Source

pub fn from_json(json: &str) -> Result<Self>

Source

pub fn save_to_json_file(&self, path: &str) -> Result<()>

Source

pub fn load_from_json_file(path: &str) -> Result<Self>

Source

pub fn create_directory(&mut self, path: &str) -> Result<()>

Source

pub fn delete_directory(&mut self, path: &str) -> Result<()>

Source

pub fn rename_directory(&mut self, old_path: &str, new_name: &str) -> Result<()>

Trait Implementations§

Source§

impl Clone for ADF

Source§

fn clone(&self) -> ADF

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ADF

Source§

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

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

impl<'de> Deserialize<'de> for ADF

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ADF

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for ADF

§

impl RefUnwindSafe for ADF

§

impl Send for ADF

§

impl Sync for ADF

§

impl Unpin for ADF

§

impl UnwindSafe for ADF

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,