[][src]Struct spectrusty::peripherals::storage::microdrives::MicroCartridge

pub struct MicroCartridge { /* fields omitted */ }

This struct represents an emulated Microdrive tape cartridge.

It consist of up to MAX_SECTORS Sectors. Instances of this struct can be "inserted" into one of 8 ZxMicrodrives's emulator drives.

Implementations

impl MicroCartridge[src]

pub fn head_at(&self) -> f32[src]

Returns the current drive's head position counted in sectors as floating point value.

The fractional part indicates how far the head position is within a sector.

pub fn max_sectors(&self) -> usize[src]

Returns the number of the emulated physical sectors on the tape.

pub fn count_formatted(&self) -> usize[src]

Returns the number of formatted sectors.

pub fn iter_with_indices(
    &self
) -> FilterMap<Enumerate<Zip<Iter<'_, Sector>, Iter<'_, Lsb0, u32>>>, &dyn Fn((usize, (&Sector, BitRef<'_, Const, Lsb0, u32>)))>
[src]

Returns an iterator of formatted sectors with their original indices.

pub fn is_write_protected(&self) -> bool[src]

Returns true if the cartridge is write protected.

pub fn set_write_protected(&mut self, protect: bool)[src]

Changes the write protected flag of the cartridge.

pub fn is_sector_formatted(&self, sector: u8) -> bool[src]

Returns true if the given sector is formatted.

Panics

Panics if sector equals to or is above the max_sectors limit.

pub fn new_with_sectors<S>(
    sectors: S,
    write_protect: bool,
    max_sectors: usize
) -> MicroCartridge where
    S: Into<Vec<Sector, Global>>, 
[src]

Creates a new instance of MicroCartridge with provided sectors.

Note

Content of the sectors is not verified and is assumed to be properly formatted.

Panics

The number of sectors provided must not be greater than MAX_USABLE_SECTORS. max_sectors must not be 0 and must be grater or equal to the number of provided sectors and must not be greater than MAX_SECTORS.

pub fn new(max_sectors: usize) -> MicroCartridge[src]

Creates a new instance of MicroCartridge with custom max_sectors number.

Panics

max_sectors must not be 0 and must not be greater than MAX_SECTORS.

Trait Implementations

impl Clone for MicroCartridge[src]

impl Debug for MicroCartridge[src]

impl Default for MicroCartridge[src]

impl<'de> Deserialize<'de> for MicroCartridge[src]

impl Index<u8> for MicroCartridge[src]

type Output = Sector

The returned type after indexing.

impl IndexMut<u8> for MicroCartridge[src]

impl<'a> IntoIterator for &'a mut MicroCartridge[src]

Iterates through formatted sectors.

type Item = &'a mut Sector

The type of the elements being iterated over.

type IntoIter = FilterMap<Zip<IterMut<'a, Sector>, Iter<'a, Lsb0, u32>>, &'a (dyn Fn((&'a mut Sector, BitRef<'a, Const, Lsb0, u32>)) + 'a)>

Which kind of iterator are we turning this into?

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

Iterates through formatted sectors.

type Item = &'a Sector

The type of the elements being iterated over.

type IntoIter = FilterMap<Zip<Iter<'a, Sector>, Iter<'a, Lsb0, u32>>, &'a (dyn Fn((&'a Sector, BitRef<'a, Const, Lsb0, u32>)) + 'a)>

Which kind of iterator are we turning this into?

impl MicroCartridgeExt for MicroCartridge[src]

impl Serialize for MicroCartridge[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<S, T> IntoSample<S> for T where
    S: FromSample<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,