Struct Qua

Source
pub struct Qua {
Show 24 fields pub audio_file: String, pub song_preview_time: i32, pub background_file: String, pub banner_file: String, pub map_id: i32, pub map_set_id: i32, pub game_mode: GameMode, pub title: String, pub artist: String, pub source: String, pub tags: String, pub creator: String, pub difficulty_name: String, pub description: String, pub genre: String, pub bpm_does_not_affect_scroll_velocity: bool, pub initial_scroll_velocity: f32, pub has_scratch_key: bool, pub editor_layers: Vec<EditorLayerInfo>, pub custom_audio_samples: Vec<CustomAudioSampleInfo>, pub sound_effects: Vec<SoundEffectInfo>, pub timing_points: Vec<TimingPointInfo>, pub slider_velocities: Vec<ScrollVelocityInfo>, pub hit_objects: Vec<HitObjectInfo>,
}
Expand description

Represents the .qua file format

Hitsounds are not considered for now. Genre is unused, but does exist in the format.

Fields§

§audio_file: String

The name of the audio file

§song_preview_time: i32

Time in milliseconds of the song where the preview starts

§background_file: String

The name of the background file

§banner_file: String

The name of the mapset banner

§map_id: i32

The unique Map Identifier (-1 if not submitted)

§map_set_id: i32

The unique Map Set identifier (-1 if not submitted)

§game_mode: GameMode

The game mode for this map

§title: String

The title of the song

§artist: String

The artist of the song

§source: String

The source of the song (album, mixtape, etc.)

§tags: String

Any tags that could be used to help find the song.

§creator: String

The creator of the map

§difficulty_name: String

The difficulty name of the map.

§description: String

A description about this map.

§genre: String

The genre of the song

§bpm_does_not_affect_scroll_velocity: bool

Indicates if the BPM changes in affect scroll velocity.

If this is set to false, SliderVelocities are in the denormalized format (BPM affects SV), and if this is set to true, SliderVelocities are in the normalized format (BPM does not affect SV).

§initial_scroll_velocity: f32

The initial scroll velocity before the first SV change.

Only matters if BPMDoesNotAffectScrollVelocity is true.

§has_scratch_key: bool

If true, the map will have a +1 scratch key, allowing for 5/8 key play

§editor_layers: Vec<EditorLayerInfo>

EditorLayer .qua data

§custom_audio_samples: Vec<CustomAudioSampleInfo>

CustomAudioSamples .qua data

§sound_effects: Vec<SoundEffectInfo>

SoundEffects .qua data

§timing_points: Vec<TimingPointInfo>

TimingPoint .qua data

§slider_velocities: Vec<ScrollVelocityInfo>

Slider Velocity .qua data

Note that SVs can be both in normalized and denormalized form, depending on BPMDoesNotAffectSV. Check WithNormalizedSVs if you need normalized SVs.

§hit_objects: Vec<HitObjectInfo>

HitObject .qua data

Implementations§

Source§

impl Qua

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Qua, QuaError>

Parse a file to a Qua struct

use qua_format::Qua;

let path = "123.qua";
let mut qua = Qua::from_file(path).expect("Could not parse qua file");
Source

pub fn from_reader<R>(reader: R) -> Result<Qua, QuaError>
where R: Read,

Parse data from a reader to a Qua struct

Source

pub fn from_slice(bytes: &[u8]) -> Result<Qua, QuaError>

Parse data from a byte slice to a Qua struct

Source

pub fn to_writer<W>(&self, writer: W) -> Result<(), QuaError>
where W: Write,

Write the Qua struct to a writer

use std::fs::File;
use qua_format::Qua;

let qua = Qua {
    title: "Freedom Dive".to_string(),
    artist: "xi".to_string(),
    ..Default::default()
};

let new_path = "test.qua";
let new_file = File::create(&new_path).expect("Could not create new file");
qua.to_writer(new_file).expect("Could not write to file");

Trait Implementations§

Source§

impl Clone for Qua

Source§

fn clone(&self) -> Qua

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Qua

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Qua
where Qua: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Qua

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Qua

Source§

type Err = QuaError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Qua

Source§

fn eq(&self, other: &Qua) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Qua

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Qua

Auto Trait Implementations§

§

impl Freeze for Qua

§

impl RefUnwindSafe for Qua

§

impl Send for Qua

§

impl Sync for Qua

§

impl Unpin for Qua

§

impl UnwindSafe for Qua

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,