from_bytes

Function from_bytes 

Source
pub fn from_bytes<D: DecodeBeatmap>(bytes: &[u8]) -> Result<D, Error>
Expand description

Parse a type that implements DecodeBeatmap by providing the content of a .osu file as a slice of bytes.

ยงExample

use rosu_map::section::metadata::Metadata;

let bytes: &[u8] = b"[General]
Mode: 2

[Metadata]
Creator: pishifat";

let metadata: Metadata = rosu_map::from_bytes(bytes)?;
assert_eq!(metadata.creator, "pishifat");