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: i64Implementations§
Source§impl Disc
impl Disc
pub fn new( tracks: Vec<Track>, sector_count: i64, source: Box<dyn SectorSource>, ) -> Disc
Sourcepub fn state_identity(&self) -> String
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)).
Sourcepub fn from_cue(sheet: &CueSheet, source: Box<dyn SectorSource>) -> Disc
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).
Sourcepub fn from_cue_path(cue_path: impl AsRef<Path>) -> Result<Disc, String>
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).
Sourcepub fn from_memory(tracks: Vec<(bool, Vec<u8>)>) -> Result<Disc, String>
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).
Sourcepub fn read_raw(&self, lba: i64) -> [u8; 2352]
pub fn read_raw(&self, lba: i64) -> [u8; 2352]
2352 bytes of sector lba; zeros outside the disc.
Sourcepub fn read_data(&self, lba: i64) -> [u8; 2048]
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).
Sourcepub fn track_at(&self, lba: i64) -> Option<&Track>
pub fn track_at(&self, lba: i64) -> Option<&Track>
The track whose range (INDEX 00 .. end) holds lba.
pub fn track(&self, number: i64) -> Option<&Track>
Sourcepub fn first_track(&self) -> i64
pub fn first_track(&self) -> i64
The first track’s number (0 for a disc without tracks, which the reference cannot answer).