Skip to main content

Imd

Struct Imd 

Source
pub struct Imd { /* private fields */ }
Expand description

There is a trivial compression scheme for the track data. Compression happens when the structure is flattened. Expansion happens when the structure is unflattened. Hence while we are working with the disk it is always expanded.

Implementations§

Source§

impl Imd

Source

pub fn create(kind: DiskKind) -> Self

Trait Implementations§

Source§

impl DiskImage for Imd

Source§

fn track_count(&self) -> usize

Get the count of formatted tracks, not necessarily the same as end_track
Source§

fn end_track(&self) -> usize

Get the id of the end-track (last-track + 1)
Source§

fn num_heads(&self) -> usize

Source§

fn nominal_capacity(&self) -> Option<usize>

Get the capacity in bytes supposing this disk were formatted in a standard way. May return None if format hints are insufficient.
Source§

fn actual_capacity(&mut self) -> Result<usize, Box<dyn Error>>

Get the capacity in bytes given the way the disk is actually formatted. The expense can be high, and may change the disk state.
Source§

fn read_block(&mut self, addr: Block) -> Result<Vec<u8>, Box<dyn Error>>

Read a block from the image; can affect disk state
Source§

fn write_block(&mut self, addr: Block, dat: &[u8]) -> Result<(), Box<dyn Error>>

Write a block to the image
Source§

fn read_sector( &mut self, trk: Track, sec: Sector, ) -> Result<Vec<u8>, Box<dyn Error>>

Read a physical sector from the image; can affect disk state.
Source§

fn write_sector( &mut self, trk: Track, sec: Sector, dat: &[u8], ) -> Result<(), Box<dyn Error>>

Write a physical sector to the image
Source§

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

Source§

fn what_am_i(&self) -> DiskImageType

Source§

fn file_extensions(&self) -> Vec<String>

Source§

fn kind(&self) -> DiskKind

Source§

fn change_kind(&mut self, kind: DiskKind)

Change the kind of disk, but do not change the format
Source§

fn to_bytes(&mut self) -> Vec<u8>

Source§

fn get_track_buf(&mut self, _trk: Track) -> Result<Vec<u8>, Box<dyn Error>>

Get the track buffer exactly in the form the image stores it
Source§

fn set_track_buf( &mut self, _trk: Track, _dat: &[u8], ) -> Result<(), Box<dyn Error>>

Set the track buffer using another track buffer, the sizes must match
Source§

fn get_track_solution( &mut self, trk: Track, ) -> Result<TrackSolution, Box<dyn Error>>

Determined sector layout and update internal formatting hints. Implement this at a low level, making as few assumptions as possible. The expense of this operation can vary widely depending on the image type.
Source§

fn get_track_nibbles(&mut self, _trk: Track) -> Result<Vec<u8>, Box<dyn Error>>

Get the track bytes as aligned nibbles; for user inspection
Source§

fn display_track(&self, _bytes: &[u8]) -> String

Write the track to a string suitable for display, input should be pre-aligned nibbles, e.g. from get_track_nibbles. Any required details of the track format have to come from the internal state of the image.
Source§

fn get_metadata(&self, indent: Option<u16>) -> String

Get image metadata into JSON string. Default contains only the image type.
Source§

fn put_metadata( &mut self, key_path: &Vec<String>, maybe_str_val: &JsonValue, ) -> Result<(), Box<dyn Error>>

Add or change a single metadata item. This is designed to take as its arguments the outputs produced by walking a JSON tree with crate::JsonCursor. The key_path has the keys leading up to the leaf, e.g., /type/item/_raw, and the val is the JSON value associated with the leaf (anything but an object). The special keys _raw and _pretty should be handled as follows. If a leaf is neither _raw nor _pretty treat it as raw. If a leaf is _pretty ignore it.
Source§

fn motor_steps_per_cyl(&self) -> usize

Source§

fn get_rz(&self, trk: Track) -> Result<[usize; 2], Box<dyn Error>>

Get the geometric [cyl,head]. Default truncates fractional tracks in a reasonable way if there are either 1 or 4 steps per track.
Source§

fn get_track(&self, trk: Track) -> Result<usize, Box<dyn Error>>

Get the geometric track. Default truncates fractional tracks in a reasonable way if there are either 1 or 4 steps per track.
Source§

fn get_rzq(&self, trk: Track, sec: Sector) -> Result<[usize; 3], Box<dyn Error>>

Get the geometric [cyl,head,sec]. Default truncates fractional tracks in a reasonable way if there are either 1 or 4 steps per track. If an explicit address is given, the sector will be taken from the most likely address byte.
Source§

fn change_format(&mut self, _fmt: DiskFormat) -> Result<(), Box<dyn Error>>

Change details of how sectors are identified and decoded
Source§

fn change_method(&mut self, _method: Method)

Change the broad method by which nibbles are extracted from a track. Emulate will try to produce nibbles just as the hardware would. Fast and Analyze will show something more idealized.
Source§

fn export_geometry( &mut self, indent: Option<u16>, ) -> Result<String, Box<dyn Error>>

Write the disk geometry, including all track solutions, into a JSON string
Source§

fn export_format(&self, _indent: Option<u16>) -> Result<String, Box<dyn Error>>

Write the abstract disk format into a JSON string

Auto Trait Implementations§

§

impl Freeze for Imd

§

impl RefUnwindSafe for Imd

§

impl Send for Imd

§

impl Sync for Imd

§

impl Unpin for Imd

§

impl UnsafeUnpin for Imd

§

impl UnwindSafe for Imd

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> 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, 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.