Struct Replay

Source
pub struct Replay {
Show 20 fields pub mode: Mode, pub version: u32, pub beatmap_hash: Option<String>, pub player_name: Option<String>, pub replay_hash: Option<String>, pub count_300: u16, pub count_100: u16, pub count_50: u16, pub count_geki: u16, pub count_katsu: u16, pub count_miss: u16, pub score: u32, pub max_combo: u16, pub perfect_combo: bool, pub mods: ModSet, pub life_graph: Option<String>, pub timestamp: DateTime<Utc>, pub replay_data: Option<Vec<Action>>, pub raw_replay_data: Option<Vec<u8>>, pub online_score_id: u64,
}
Expand description

An osu! replay. The replay might come from a large ScoreList score database, or from an individual standalone .osr file.

Fields§

§mode: Mode

The gamemode the replay was scored in.

§version: u32

The .db version of the replay file. If the replay is inside a scores.db file, the version should be redundant with it (?).

§beatmap_hash: Option<String>

The MD5 hash of the beatmap played.

§player_name: Option<String>

The name of the player who scored the replay.

§replay_hash: Option<String>

The replay-specific MD5 hash.

§count_300: u16

Amount of 300s (fruits in ctb).

§count_100: u16

Amount of 100s (drops in ctb, 150s in taiko and 200s in mania).

§count_50: u16

Amount of 50s (droplets in ctb).

§count_geki: u16

Amount of gekis (“MAX scores” or “rainbow 300s” in mania).

§count_katsu: u16

Amount of katsus (200s in mania, droplet misses in ctb).

§count_miss: u16

Amount of misses (fruit + drop misses in ctb).

§score: u32

The numerical score achieved.

§max_combo: u16§perfect_combo: bool§mods: ModSet

The mod combination with which the replay was done.

§life_graph: Option<String>

A string representing a graph of how much life bar did the player have along the beatmap.

It is a comma-separated list of human-readable entries in the form <offset>|<life>, where <offset> is the amount of milliseconds since the start of the song and <life> is a number between 0 and 1 representing the amount of life left.

§timestamp: DateTime<Utc>

When was the replay scored.

§replay_data: Option<Vec<Action>>

Decompressed replay data.

Only available on standalone .osr replays, and if the compression feature is enabled (enabled by default).

When writing .osr files (and .osr files only), if the compression feature is enabled and this field is Some, these actions will be compressed and written. Otherwise, raw_replay_data will be written instead.

§raw_replay_data: Option<Vec<u8>>

Raw replay data, available on .osr files even if the compression feature is not enabled.

When writing, this field is used as a fallback if replay_data is None or the compression feature is disabled.

§online_score_id: u64

Online score id. Only has a useful value on replays embedded in a ScoreList.

Implementations§

Source§

impl Replay

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Replay, Error>

Parse a replay from its raw bytes.

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Replay, Error>

Read a replay from a standalone .osr osu! replay file.

Source

pub fn to_writer<W: Write>( &self, out: W, compression_level: Option<u32>, ) -> Result<()>

Write the replay to an arbitrary writer, with the given compression level.

If the compression level is None the arbitrary default replay::DEFAULT_COMPRESSION_LEVEL will be used. If the compression feature is disabled this argument has no effect.

Source

pub fn save<P: AsRef<Path>>( &self, path: P, compression_level: Option<u32>, ) -> Result<()>

Similar to to_writer but writes the replay to an osr file.

Trait Implementations§

Source§

impl Clone for Replay

Source§

fn clone(&self) -> Replay

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Replay

Source§

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

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

impl PartialEq for Replay

Source§

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

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

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 StructuralPartialEq for Replay

Auto Trait Implementations§

§

impl Freeze for Replay

§

impl RefUnwindSafe for Replay

§

impl Send for Replay

§

impl Sync for Replay

§

impl Unpin for Replay

§

impl UnwindSafe for Replay

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, 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.