Skip to main content

Block

Enum Block 

Source
pub enum Block {
    D13([usize; 2]),
    DO([usize; 2]),
    PO(usize),
    CPM((usize, u8, u16)),
    FAT((u64, u8)),
    D64([usize; 2]),
}
Expand description

Encapsulates the disk address and addressing mode used by a file system. Disk addresses generally involve some transformation between logical (file system) and physical (disk fields) addresses. Disk images are responsible for serving blocks in response to a file system request, see the ‘img’ docstring for more. The Block implementation includes a simple mapping from blocks to sectors; disk images can use this or not as appropriate.

Variants§

§

D13([usize; 2])

value is [track,sector]

§

DO([usize; 2])

value is [track,sector]

§

PO(usize)

value is block number

§

CPM((usize, u8, u16))

value is (absolute block number, BSH, OFF); see cpm::types

§

FAT((u64, u8))

value is (first logical sector,num sectors)

§

D64([usize; 2])

value is [track,sector]

Implementations§

Source§

impl Block

Source

pub fn get_lsecs(&self, secs_per_track: usize) -> Vec<[usize; 2]>

Get a track-sector list for this block. At this level we can only assume a simple monotonically increasing relationship between blocks and sectors. Any further skewing must be handled by the caller. CP/M and FAT offsets are accounted for. For CP/M be sure to use 128 byte logical sectors when computing secs_per_track.

Trait Implementations§

Source§

impl Clone for Block

Source§

fn clone(&self) -> Block

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 Copy for Block

Source§

impl Display for Block

Source§

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

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

impl Eq for Block

Source§

impl Hash for Block

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Block

Source§

fn eq(&self, other: &Block) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Block

Auto Trait Implementations§

§

impl Freeze for Block

§

impl RefUnwindSafe for Block

§

impl Send for Block

§

impl Sync for Block

§

impl Unpin for Block

§

impl UnsafeUnpin for Block

§

impl UnwindSafe for Block

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.