4 releases

Uses old Rust 2015

0.1.3 Apr 13, 2022
0.1.2 Apr 13, 2022
0.1.1 Apr 13, 2022
0.1.0 Apr 13, 2022

#1656 in Parser implementations

Download history 10/week @ 2023-12-17 104/week @ 2023-12-24 42/week @ 2023-12-31 15/week @ 2024-01-07 3/week @ 2024-01-14 1/week @ 2024-01-21 3/week @ 2024-01-28 9/week @ 2024-02-04 29/week @ 2024-02-11 27/week @ 2024-02-18 27/week @ 2024-02-25 26/week @ 2024-03-03 39/week @ 2024-03-10 23/week @ 2024-03-17 31/week @ 2024-03-24 81/week @ 2024-03-31

178 downloads per month
Used in 2 crates (via bliss-audio)

MIT license

40KB
767 lines

rcue

crates.io

Documentation

Simple CUE sheet reader for Rust. Has no dependencies and compiles on stable.

Usage

See generated documentation or tests in parser.rs for usage and some examples.

Add this to your Cargo.toml under [dependencies]

via crates.io

rcue = "*"

or from GitHub directly

rcue = { git = "https://github.com/gyng/rcue" }

In your program:

extern crate rcue;

use rcue::parser::parse;
use rcue::parser::parse_from_file;

fn main() {
    let cue = parse_from_file("test/fixtures/unicode.cue", true).unwrap();
    assert_eq!(cue.title, Some("マジコカタストロフィ".to_string()));

    let file = std::fs::File::open("test/fixtures/unicode.cue").unwrap();
    let mut buf_reader = std::io::BufReader::new(file);
    let cue = parse(&mut buf_reader, true).unwrap();
    assert_eq!(cue.title, Some("マジコカタストロフィ".to_string()));
}

Limitations and notes

The current implementation has the following known limitations:

  • Indentation is treated as insignificant (= no proper contextual support). For example, if REM fields appear after a TRACK field (but are indented to the FILE's level, it will be wrongly assigned to the TRACK instead.

    FILE "audio.wav" WAVE
        TRACK 01 AUDIO
            TITLE "track1"
    REM DISCID 860B640B ← This is wrongly(?) assigned to the TRACK
    
  • Extraneous whitespace between fields causes parsing to fail.

    REM COMMENT           "A lot of extra spaces"
    
  • Escaped double quotation marks in strings \" are escaped into ".

Development

Verbose log information

For verbose logging to STDOUT and details on skipped lines in lenient mode, run rcue with the environment variable RCUE_LOG set to 1. For example:

# myapp.rs
RCUE_LOG=1 cargo run

Fuzzing

The parser fuzz test for rcue can be run using cargo fuzz in nightly.

cargo install cargo-fuzz -f
cargo +nightly fuzz run fuzz_parser

Clippy

Run clippy using

rustup install nightly # if not installed
rustup update nightly
cargo +nightly install clippy --force # --force to update
rustup run nightly cargo clippy

TODO

  • Significant indentation/context support
  • Serializer
  • Clean up parsing even more

No runtime deps