rhythm-open-exchange 0.2.2

A try to create the ffmpeg of vsrg
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Parser for Quaver .qua files using `serde_yaml`.

use super::types::QuaChart;
use crate::error::{RoxError, RoxResult};

/// Parse a .qua file into a `QuaChart`.
///
/// # Errors
///
/// Returns an error if:
/// - The data is not valid UTF-8
/// - The YAML is malformed
pub fn parse(data: &[u8]) -> RoxResult<QuaChart> {
    let content = std::str::from_utf8(data)
        .map_err(|e| RoxError::InvalidFormat(format!("Invalid UTF-8: {e}")))?;

    serde_yaml::from_str(content).map_err(|e| RoxError::InvalidFormat(format!("Invalid YAML: {e}")))
}