Skip to main content

FileEntry

Struct FileEntry 

Source
pub struct FileEntry<'a> {
    pub track_of_first_track_sector_list_sector: u8,
    pub sector_of_first_track_sector_list_sector: u8,
    pub file_type: FileType,
    pub locked: bool,
    pub file_name: &'a [u8],
    pub file_length_in_sectors: u16,
}
Expand description

A file entry

Fields§

§track_of_first_track_sector_list_sector: u8

Track index of the start of the file

§sector_of_first_track_sector_list_sector: u8

Sector index of the start of the file

§file_type: FileType

The file type

§locked: bool

Whether the file is locked

§file_name: &'a [u8]

The file name, bytes 0x03-0x20 (30 bytes)

§file_length_in_sectors: u16

The file length in number of sectors

Implementations§

Source§

impl<'a> FileEntry<'a>

Custom implmentations for the FileEntry structure These patterns would be useful for the FAT parser and other resource-constrained and performance-oriented target codebases, as long as caching isn’t required A separate data structure could be added to cache the result of these filename calculations

Source

pub fn new( track_of_first_track_sector_list_sector: u8, sector_of_first_track_sector_list_sector: u8, file_type: FileType, locked: bool, filename: &str, file_length_in_sectors: u16, ) -> FileEntry<'_>

Create a new FileEntry with the given data

§Examples
use image_rider::disk_format::apple::catalog::{FileEntry, FileType};

let fe = FileEntry::new(0x12, 0x0F, FileType::AppleSoftBasic, false, "HELLO", 0x0002);
assert_eq!(fe.filename().unwrap(), "HELLO");
Source

pub fn filename(&self) -> Result<String, FromUtf8Error>

Return the filename as a String

Source

pub fn get_data( &self, tracks: &[Vec<&[u8]>], track_sector_lists: &TrackSectorLists<'_>, ) -> Result<Vec<u8>, Error>

Get the data for a file

Source

pub fn build_file( &self, tracks: &[Vec<&'a [u8]>], ) -> Result<TrackSectorLists<'a>, Error>

Build a file from a file entry TODO: Get the tracks / sectors down correctly E.g. tracks are a vector of sectors

Trait Implementations§

Source§

impl<'a> Clone for FileEntry<'a>

Source§

fn clone(&self) -> FileEntry<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for FileEntry<'a>

Source§

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

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

impl Display for FileEntry<'_>

Format a FileEntry for display

Source§

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

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

impl<'a> Serializer<'a> for FileEntry<'a>

Source§

fn as_vec(&'a self) -> Result<Vec<u8>, Error>

Serialize a structure to a vector of bytes
Source§

impl<'a> Copy for FileEntry<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for FileEntry<'a>

§

impl<'a> RefUnwindSafe for FileEntry<'a>

§

impl<'a> Send for FileEntry<'a>

§

impl<'a> Sync for FileEntry<'a>

§

impl<'a> Unpin for FileEntry<'a>

§

impl<'a> UnsafeUnpin for FileEntry<'a>

§

impl<'a> UnwindSafe for FileEntry<'a>

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,