Trait cbm::disk::Disk[][src]

pub trait Disk {
    fn native_disk_format(&self) -> &'static DiskFormat;
fn disk_format(&self) -> Result<&DiskFormat>;
fn disk_format_mut(&mut self) -> Result<&mut DiskFormat>;
fn set_disk_format(&mut self, disk_format: Option<DiskFormat>);
fn blocks(&self) -> Rc<RefCell<BlockDevice>>;
fn blocks_ref(&self) -> Ref<BlockDevice>;
fn blocks_ref_mut(&self) -> RefMut<BlockDevice>;
fn header(&self) -> Result<&Header>;
fn header_mut(&mut self) -> Result<&mut Header>;
fn set_header(&mut self, header: Option<Header>);
fn flush_header(&mut self) -> Result<()>;
fn bam(&self) -> Result<Rc<RefCell<BAM>>>;
fn set_bam(&mut self, bam: Option<BAM>); fn initialize(&mut self) { ... }
fn write_format(&mut self, name: &Petscii, id: &Id) -> Result<()> { ... }
fn iter(&self) -> DirectoryIterator { ... }
fn directory(&self) -> Result<Vec<DirectoryEntry>> { ... }
fn find_directory_entry(&self, filename: &Petscii) -> Result<DirectoryEntry> { ... }
fn next_free_directory_entry(&mut self) -> Result<DirectoryEntry> { ... }
fn write_directory_entry(&mut self, entry: &DirectoryEntry) -> Result<()> { ... }
fn check_filename_availability(&self, filename: &Petscii) -> Result<()> { ... }
fn rename(
        &mut self,
        original_filename: &Petscii,
        new_filename: &Petscii
    ) -> Result<()> { ... }
fn open_file(&self, filename: &Petscii) -> Result<File> { ... }
fn open_file_from_entry(&self, entry: &DirectoryEntry) -> Result<File> { ... }
fn create_file(
        &mut self,
        filename: &Petscii,
        file_type: FileType,
        scheme: Scheme
    ) -> Result<File> { ... }
fn read_sector<'a>(&self, location: Location) -> Result<Vec<u8>> { ... }
fn write_sector(&mut self, location: Location, data: &[u8]) -> Result<()> { ... }
fn dump(&mut self, writer: &mut Write) -> Result<()> { ... }
fn name<'a>(&'a self) -> Option<&'a Petscii> { ... }
fn validate(&self) -> Result<Vec<ValidationError>> { ... }
fn blocks_free(&self) -> Result<usize> { ... } }

All disk image types implement the Disk trait, and most disk operations can be performed polymorphically using Disk as a trait object.

Required Methods

Provided Methods

Initialize the disk by reading the format metadata, if any. This may be called again, for example, when the BAM or header have been re-written.

Format the disk image. Currently, this does not accurately reflect the exact formatting method used by the 1541/1571/1581 CBM DOS.

Important traits for DirectoryIterator

Return an iterator of directory entries found on this disk image.

Return a list of all directory entries

Locate a directory entry based on its filename.

Return a DirectoryEntry representing the next free slot on the directory track. This entry may be used to create a new directory entry by populating its fields and passing it to write_directory_entry().

Write the the provide directory entry to disk, using the same slot as it was originally read from.

Confirm that no directory entry currently exists with the provided filename.

Rename a file.

Open a file based on its filename.

Open a file based on its directory entry.

Create a new file on the disk. It will be initialized as a closed zero-length file, and a file handle will be returned which may be used to provision a writer.

Read a specific block from the disk, given its track and sector location.

Write a block of data to a specific location on the disk.

Write a hex dump of the disk image to the provided writer.

Return the name of this disk as found in the disk header.

Check the consistency of the disk image. Unlike the "validate" ("v0:") command in CBM DOS, this is a read-only operation and does not attempt any repairs. A list of validation errors is returned.

Return the blocks free based on the BAM free sector counts. (Not based on the BAM bitmaps, nor on the file sizes in the directory entries.)

Trait Implementations

impl Display for Disk
[src]

Formats the value using the given formatter. Read more

impl Debug for Disk
[src]

Formats the value using the given formatter. Read more

impl<'a> IntoIterator for &'a Disk
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Implementors