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: u8Track index of the start of the file
sector_of_first_track_sector_list_sector: u8Sector index of the start of the file
file_type: FileTypeThe file type
locked: boolWhether the file is locked
file_name: &'a [u8]The file name, bytes 0x03-0x20 (30 bytes)
file_length_in_sectors: u16The 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
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
Sourcepub 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<'_>
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");Sourcepub fn filename(&self) -> Result<String, FromUtf8Error>
pub fn filename(&self) -> Result<String, FromUtf8Error>
Return the filename as a String
Sourcepub fn get_data(
&self,
tracks: &[Vec<&[u8]>],
track_sector_lists: &TrackSectorLists<'_>,
) -> Result<Vec<u8>, Error>
pub fn get_data( &self, tracks: &[Vec<&[u8]>], track_sector_lists: &TrackSectorLists<'_>, ) -> Result<Vec<u8>, Error>
Get the data for a file
Sourcepub fn build_file(
&self,
tracks: &[Vec<&'a [u8]>],
) -> Result<TrackSectorLists<'a>, Error>
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> Serializer<'a> for FileEntry<'a>
impl<'a> Serializer<'a> for FileEntry<'a>
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> 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