Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder {
    // Required method
    fn encode(chart: &RoxChart) -> RoxResult<Vec<u8>>;

    // Provided methods
    fn encode_to_path(chart: &RoxChart, path: impl AsRef<Path>) -> RoxResult<()> { ... }
    fn encode_to_string(chart: &RoxChart) -> RoxResult<String> { ... }
}
Expand description

Trait for encoding from ROX to external formats.

Required Methods§

Source

fn encode(chart: &RoxChart) -> RoxResult<Vec<u8>>

Encode a chart to raw bytes.

§Errors

Returns an error if the chart is invalid or encoding fails.

Provided Methods§

Source

fn encode_to_path(chart: &RoxChart, path: impl AsRef<Path>) -> RoxResult<()>

Encode a chart to a file path.

§Errors

Returns an error if encoding fails or the file cannot be written.

Source

fn encode_to_string(chart: &RoxChart) -> RoxResult<String>

Encode a chart to a String (for text-based formats like .osu).

§Errors

Returns an error if encoding fails or the output is not valid UTF-8.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§