Struct cue::cd::CD [] [src]

pub struct CD { /* fields omitted */ }

The CD struct represents the entirety of a CD, which is the core unit of a CUE sheet. This struct contains the parsing methods used as the primary entry point to libcue's functionality.

A CD can be a pure CD audio disc, a pure data disc, or a mixed-mode disc containing both data and audio tracks in arbitrary order. A CD will always have at least one track.

Here's an example of a simple function which parses a CUE sheet and prints information about its contents:

use cue::cd::{CD, DiscMode};
use cue::track::{TrackMode, TrackSubMode};

let cue_sheet = "FILE \"example.img\" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    PREGAP 00:02:00
    INDEX 01 58:41:36
  TRACK 03 AUDIO
    INDEX 00 61:06:08
    INDEX 01 61:08:08
";

let cd = CD::parse(cue_sheet.to_string()).unwrap();

println!("Number of tracks: {}", cd.get_track_count());
let mode = match cd.get_mode() {
    DiscMode::CD_DA => "CD-DA",
    DiscMode::CD_ROM => "CD-ROM",
    DiscMode::CD_ROM_XA => "CD-ROM XA",
};
println!("Mode: {}", mode);
println!("");

for (index, track) in cd.tracks().iter().enumerate() {
    println!("Track {}", index + 1);
    println!("Filename: {}", track.get_filename());
    println!("Start: {}", track.get_start());
    println!("Length: {}", track.get_length());
    println!("Pregap: {}", track.get_zero_pre());
    println!("Postgap: {}", track.get_zero_post());
    println!("");
}

Methods

impl CD
[src]

[src]

Parses a string containing a CUE sheet and returns a CD struct.

Errors

Returns a NulError if the provided string contains any null bytes.

[src]

Reads the file contained at path and parses it like the parse function above.

[src]

Returns a DiscMode value indicating the type of disc represented by this CUE sheet. Individual tracks also have types; see Track.get_mode and Track.get_sub_mode.

[src]

Returns the path on disc to the sidecar metadata file containing CD-TEXT metadata, if any.

Safety

This may segfault if there is no CD-TEXT sidecar.

[src]

Returns the total number of tracks in this CD.

[src]

Returns a Track struct for the track at the requested index. Note that track numbering starts from 1; there is no track 0.

Errors

If the requested track doesn't exist in the CD, returns Err with a string containing an error message.

Important traits for Vec<u8>
[src]

Returns a Vec containing every track in the CD.

[src]

Returns a CDText representing the CD-TEXT data stored within this CUE sheet.

[src]

Returns a REM representing the comments stored within this CUE sheet.

Trait Implementations

impl Drop for CD
[src]

[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl !Send for CD

impl !Sync for CD