pub trait SectorExt {
Show 24 methods fn is_free(&self) -> bool; fn catalog_name(&self) -> &[u8; 10]; fn file_name(&self) -> &[u8; 10]; fn file_name_matches(&self, name: &[u8]) -> bool; fn file_type(&self) -> Result<Option<CatFileType>, &'static str>; fn sector_seq(&self) -> u8; fn file_block_seq(&self) -> u8; fn file_block_len(&self) -> u16; fn is_last_file_block(&self) -> bool; fn is_save_file(&self) -> bool; fn data(&self) -> &[u8] ; fn data_mut(&mut self) -> &mut [u8] ; fn data_record(&self) -> &[u8] ; fn set_file_name(&mut self, file_name: &[u8]); fn set_file_block_seq(&mut self, block_seq: u8); fn set_file_block_len(&mut self, len: u16); fn set_last_file_block(&mut self, eof: bool); fn set_save_file_flag(&mut self, is_save: bool); fn update_block_checksums(&mut self); fn erase(&mut self); fn format(&mut self, seq: u8, catalog_name: &[u8]); fn validate(&self) -> Result<(), &'static str>; fn file_header(&self) -> Result<Option<&MdrFileHeader>, &'static str>; fn tap_header(&self) -> Result<Option<Header>, &'static str>;
}
Expand description

Extends MicroCartridge’s Sector with methods for reading and manipulating Microdrive’s file system.

Required Methods§

Returns true if sector is free.

Returns the name in sector’s header.

Returns the name in blocks’s header.

Returns true if the given name matches name in the blocks’s header.

Returns a file type of this sector if the sector is occupied.

Returns HDNUMB entry of the sector’s header.

Returns RECNUM entry of the blocks’s header.

Returns RECLEN entry of the blocks’s header.

Returns an EOF flag’s state of RECFLG entry of the blocks’s header.

Returns a SAVE flag’s state of RECFLG entry of the blocks’s header.

Returns a reference to the data segment.

Returns a mutable reference to the data segment.

Returns a reference to the data segment limited in size by the RECLEN entry.

Changes the name in blocks’s header.

Changes RECNUM entry of the blocks’s header.

Changes RECLEN entry of the blocks’s header.

Changes an EOF flag of RECFLG entry of the blocks’s header.

Changes a SAVE flag of RECFLG entry of the blocks’s header.

Updates checksums of a block segment.

Marks current sector as free. Updates block’s header checksum.

Formats this sector with the given sector number (1 - 254) and catalog_name.

Panics

If seq is not in [1, 254] range.

Validates the integrity of sector’s content.

Returns a reference to the file header if this sector is the first sector of a SAVE * file.

Creates a TAP Header if this sector is the first sector of a SAVE * file.

Implementors§