Disc

Struct Disc 

Source
pub struct Disc {
    pub tracks: Vec<Track>,
    pub sector_count: i64,
    /* private fields */
}
Expand description

A sector store plus a TOC. sector_count is the number of LBAs.

Media, not state: a save state names the disc (state_identity), it does not hold it.

Fields§

§tracks: Vec<Track>§sector_count: i64

Implementations§

Source§

impl Disc

Source

pub fn new( tracks: Vec<Track>, sector_count: i64, source: Box<dyn SectorSource>, ) -> Disc

Source

pub fn state_identity(&self) -> String

What a save state records of the disc: its table of contents (not its sectors, so two discs with one layout are not told apart). The same digest as the reference’s: the SHA-1 of Python’s repr(([(number, is_data, start, end), ...], sector_count)).

Source

pub fn from_cue(sheet: &CueSheet, source: Box<dyn SectorSource>) -> Disc

The disc of a parsed cue sheet, its sectors from source (a CueSource over the sheet’s files, or anything else that answers the sheet’s LBAs).

Source

pub fn from_cue_path(cue_path: impl AsRef<Path>) -> Result<Disc, String>

A bin/cue pair on disk, read in place (the reference’s Disc.from_cue).

Source

pub fn from_memory(tracks: Vec<(bool, Vec<u8>)>) -> Result<Disc, String>

A disc whose tracks are raw 2352-byte sectors in memory: (is_data, bytes) each. Used by the tests (tests/discs.rs builds the bytes).

Source

pub fn read_raw(&self, lba: i64) -> [u8; 2352]

2352 bytes of sector lba; zeros outside the disc.

Source

pub fn read_data(&self, lba: i64) -> [u8; 2048]

The 2048-byte user data of a Mode 1 sector (zeros if it is not a data sector).

Source

pub fn track_at(&self, lba: i64) -> Option<&Track>

The track whose range (INDEX 00 .. end) holds lba.

Source

pub fn track(&self, number: i64) -> Option<&Track>

Source

pub fn first_track(&self) -> i64

The first track’s number (0 for a disc without tracks, which the reference cannot answer).

Source

pub fn last_track(&self) -> i64

Source

pub fn end_lba(&self) -> i64

Auto Trait Implementations§

§

impl !Freeze for Disc

§

impl !RefUnwindSafe for Disc

§

impl !Send for Disc

§

impl !Sync for Disc

§

impl Unpin for Disc

§

impl !UnwindSafe for Disc

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> Same for T

Source§

type Output = T

Should always be Self
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.