pub struct GameModsIntermode { /* private fields */ }Expand description
Combination of GameModIntermodes.
Implementations§
Source§impl GameModsIntermode
impl GameModsIntermode
Sourcepub fn bits(&self) -> u32
pub fn bits(&self) -> u32
Return the accumulated bit values of all contained mods.
Mods that don’t have bit values will be ignored. See https://github.com/ppy/osu-api/wiki#mods
§Example
use rosu_mods::mods;
let hdhrdtwu = mods!(HD HR DT WU);
assert_eq!(hdhrdtwu.bits(), 8 + 16 + 64);Sourcepub fn checked_bits(&self) -> Option<u32>
pub fn checked_bits(&self) -> Option<u32>
Return the accumulated bit values of all contained mods.
If any contained mod has no bit value None is returned.
See https://github.com/ppy/osu-api/wiki#mods
§Example
use rosu_mods::mods;
let hdhrdt = mods!(HD HR DT);
assert_eq!(hdhrdt.checked_bits(), Some(8 + 16 + 64));
let hdhrdtwu = mods!(HD HR DT WU);
assert_eq!(hdhrdtwu.checked_bits(), None);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if no mods are contained.
§Example
use rosu_mods::{GameModIntermode, GameModsIntermode};
let mut mods = GameModsIntermode::new();
assert!(mods.is_empty());
mods.insert(GameModIntermode::Hidden);
assert!(!mods.is_empty());Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the amount of contained mods.
§Example
use rosu_mods::{mods, GameModIntermode, GameModsIntermode};
let hdhrdt = mods!(HD HR DT);
assert_eq!(hdhrdt.len(), 3);
let mut nm = GameModsIntermode::new();
assert_eq!(nm.len(), 0);
assert_eq!(nm.to_string(), "NM");Sourcepub fn insert(&mut self, gamemod: GameModIntermode)
pub fn insert(&mut self, gamemod: GameModIntermode)
Add a GameModIntermode
§Example
use rosu_mods::{GameModIntermode, GameModsIntermode};
let mut mods = GameModsIntermode::new();
assert_eq!(mods.to_string(), "NM");
mods.insert(GameModIntermode::Traceable);
assert_eq!(mods.to_string(), "TC");
mods.insert(GameModIntermode::HardRock);
assert_eq!(mods.to_string(), "HRTC");Sourcepub fn contains<M>(&self, gamemod: M) -> boolwhere
GameModIntermode: From<M>,
pub fn contains<M>(&self, gamemod: M) -> boolwhere
GameModIntermode: From<M>,
Check whether a given mod is contained.
§Example
use rosu_mods::{mods, GameModIntermode};
let hd = mods!(HD);
assert!(hd.contains(GameModIntermode::Hidden));
assert!(!hd.contains(GameModIntermode::HardRock));Sourcepub fn contains_acronym(&self, acronym: Acronym) -> bool
pub fn contains_acronym(&self, acronym: Acronym) -> bool
Sourcepub fn remove<M>(&mut self, gamemod: M) -> boolwhere
GameModIntermode: From<M>,
pub fn remove<M>(&mut self, gamemod: M) -> boolwhere
GameModIntermode: From<M>,
Remove a gamemod and return whether it was contained.
§Example
use rosu_mods::{mods, GameModIntermode, GameModsIntermode};
let mut mods: GameModsIntermode = mods!(HD HR);
assert!(mods.remove(GameModIntermode::Hidden));
assert_eq!(mods.to_string(), "HR");
assert!(!mods.remove(GameModIntermode::DoubleTime));Sourcepub fn remove_all<I, M>(&mut self, mods: I)
pub fn remove_all<I, M>(&mut self, mods: I)
Remove all mods contained in the iterator.
§Example
use rosu_mods::{mods, GameModIntermode, GameModsIntermode};
let mut mods: GameModsIntermode = mods!(HD HR WG DT BR);
mods.remove_all([GameModIntermode::Hidden, GameModIntermode::Easy]);
assert_eq!(mods.to_string(), "DTHRBRWG");
mods.remove_all(mods!(NF WG));
assert_eq!(mods.to_string(), "DTHRBR")Sourcepub fn from_bits(bits: u32) -> Self
pub fn from_bits(bits: u32) -> Self
Parse bitflags into GameModsIntermode
§Example
use rosu_mods::{mods, GameModsIntermode};
let bits = 8 + 64 + 512 + 1024;
assert_eq!(GameModsIntermode::from_bits(bits), mods!(FL HD NC))Sourcepub fn try_from_acronyms(s: &str) -> Option<Self>
pub fn try_from_acronyms(s: &str) -> Option<Self>
Try to parse a combination of mod acronyms into GameModsIntermode.
Returns None if an unknown acronym was encountered.
§Example
use rosu_mods::GameModsIntermode;
let hdhrwu = GameModsIntermode::try_from_acronyms("HRWUHD").unwrap();
assert_eq!(hdhrwu.to_string(), "HDHRWU");
assert!(GameModsIntermode::try_from_acronyms("QQQ").is_none());Sourcepub fn from_acronyms(s: &str) -> Self
pub fn from_acronyms(s: &str) -> Self
Parse a combination of mod acronyms into GameModsIntermode.
§Example
use rosu_mods::GameModsIntermode;
let hdhrwu = GameModsIntermode::from_acronyms("HRWUHD");
assert_eq!(hdhrwu.len(), 3);
assert_eq!(hdhrwu.to_string(), "HDHRWU");
let mut iter = GameModsIntermode::from_acronyms("QQhdQ").into_iter();
assert_eq!(iter.next().unwrap().to_string(), "HDQ"); // unknown mod
assert_eq!(iter.next().unwrap().to_string(), "QQ"); // unknown mod
assert!(iter.next().is_none());Sourcepub fn intersection<'m>(
&'m self,
other: &'m GameModsIntermode,
) -> GameModsIntermodeIntersection<'m> ⓘ
pub fn intersection<'m>( &'m self, other: &'m GameModsIntermode, ) -> GameModsIntermodeIntersection<'m> ⓘ
Returns an iterator over all mods that appear in both GameModsIntermode.
§Example
use rosu_mods::{mods, GameModIntermode};
let hd = mods!(HD);
let hdhr = mods!(HD HR);
let mut intersection = hd.intersection(&hdhr);
assert_eq!(intersection.next(), Some(GameModIntermode::Hidden));
assert_eq!(intersection.next(), None);Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Sourcepub fn legacy_clock_rate(&self) -> f64
pub fn legacy_clock_rate(&self) -> f64
The legacy clock rate of the GameModsIntermode.
Looks for the first occurrence of DT, NC, HT, or DC
and returns 1.5, 0.75, or 1.0 accordingly.
§Example
use rosu_mods::{mods, GameModIntermode};
let hd = mods!(HD);
assert_eq!(hd.legacy_clock_rate(), 1.0);
let mut hddt = hd;
hddt.insert(GameModIntermode::DoubleTime);
assert_eq!(hddt.legacy_clock_rate(), 1.5);Sourcepub fn iter(&self) -> GameModsIntermodeIter<'_> ⓘ
pub fn iter(&self) -> GameModsIntermodeIter<'_> ⓘ
Returns an iterator over all contained mods.
Note that the iterator will immediately yield None in case of “NoMod”.
Sourcepub fn try_with_mode(&self, mode: GameMode) -> Option<GameMods>
pub fn try_with_mode(&self, mode: GameMode) -> Option<GameMods>
Tries to turn a GameModsIntermode into a GameMods.
Returns None if any contained GameModIntermode is unknown for the
given GameMode.
§Example
use rosu_mods::{mods, GameMods, GameMode};
let dtfi: GameMods = mods!(DT FI).try_with_mode(GameMode::Mania).unwrap();
// The FadeIn mod doesn't exist in Taiko
assert!(mods!(DT FI).try_with_mode(GameMode::Taiko).is_none());Sourcepub fn with_mode(&self, mode: GameMode) -> GameMods
pub fn with_mode(&self, mode: GameMode) -> GameMods
Turn a GameModsIntermode into a GameMods.
Any contained GameModIntermode that’s unknown for the given
GameMode will be replaced with GameModIntermode::Unknown.
§Example
use rosu_mods::{mods, GameMods, GameMode};
let dtfi: GameMods = mods!(DT FI).with_mode(GameMode::Mania);
// The FadeIn mod doesn't exist in Taiko
let dt_unknown: GameMods = mods!(DT FI).with_mode(GameMode::Taiko);
assert_eq!(dt_unknown.to_string(), "DTFI");Sourcepub fn as_legacy(&self) -> GameModsLegacy
pub fn as_legacy(&self) -> GameModsLegacy
Turns GameModsIntermode into GameModsLegacy.
Sourcepub fn try_as_legacy(&self) -> Option<GameModsLegacy>
pub fn try_as_legacy(&self) -> Option<GameModsLegacy>
Attempts to turns GameModsIntermode into GameModsLegacy.
Returns None if any contained GameModIntermode does not have a
bit value.
Trait Implementations§
Source§impl Archive for GameModsIntermode
Available on crate feature rkyv only.
impl Archive for GameModsIntermode
rkyv only.Source§type Archived = <Vec<GameModIntermode> as Archive>::Archived
type Archived = <Vec<GameModIntermode> as Archive>::Archived
Source§type Resolver = VecResolver
type Resolver = VecResolver
Source§fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl BitOr<GameModIntermode> for GameModsIntermode
impl BitOr<GameModIntermode> for GameModsIntermode
Source§fn bitor(self, rhs: GameModIntermode) -> Self::Output
fn bitor(self, rhs: GameModIntermode) -> Self::Output
Adds a GameModIntermode to the GameModsIntermode.
Source§type Output = GameModsIntermode
type Output = GameModsIntermode
| operator.Source§impl BitOrAssign<GameModIntermode> for GameModsIntermode
impl BitOrAssign<GameModIntermode> for GameModsIntermode
Source§fn bitor_assign(&mut self, rhs: GameModIntermode)
fn bitor_assign(&mut self, rhs: GameModIntermode)
Adds a GameModIntermode to the GameModsIntermode.
Source§impl Clone for GameModsIntermode
impl Clone for GameModsIntermode
Source§fn clone(&self) -> GameModsIntermode
fn clone(&self) -> GameModsIntermode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GameModsIntermode
impl Debug for GameModsIntermode
Source§impl Default for GameModsIntermode
impl Default for GameModsIntermode
Source§fn default() -> GameModsIntermode
fn default() -> GameModsIntermode
Source§impl<'de> Deserialize<'de> for GameModsIntermode
Available on crate feature serde only.
impl<'de> Deserialize<'de> for GameModsIntermode
serde only.Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl<D: Fallible + ?Sized> Deserialize<GameModsIntermode, D> for ArchivedVec<Archived<GameModIntermode>>
Available on crate feature rkyv only.
impl<D: Fallible + ?Sized> Deserialize<GameModsIntermode, D> for ArchivedVec<Archived<GameModIntermode>>
rkyv only.Source§fn deserialize(&self, _: &mut D) -> Result<GameModsIntermode, D::Error>
fn deserialize(&self, _: &mut D) -> Result<GameModsIntermode, D::Error>
Source§impl Display for GameModsIntermode
impl Display for GameModsIntermode
Source§impl<M> Extend<M> for GameModsIntermodewhere
GameModIntermode: From<M>,
impl<M> Extend<M> for GameModsIntermodewhere
GameModIntermode: From<M>,
Source§fn extend<T: IntoIterator<Item = M>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = M>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<GameModIntermode> for GameModsIntermode
impl From<GameModIntermode> for GameModsIntermode
Source§fn from(gamemod: GameModIntermode) -> Self
fn from(gamemod: GameModIntermode) -> Self
Source§impl From<GameMods> for GameModsIntermode
impl From<GameMods> for GameModsIntermode
Source§impl From<GameModsLegacy> for GameModsIntermode
impl From<GameModsLegacy> for GameModsIntermode
Source§fn from(mods: GameModsLegacy) -> Self
fn from(mods: GameModsLegacy) -> Self
Source§impl<M> FromIterator<M> for GameModsIntermodewhere
GameModIntermode: From<M>,
impl<M> FromIterator<M> for GameModsIntermodewhere
GameModIntermode: From<M>,
Source§fn from_iter<T: IntoIterator<Item = M>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = M>>(iter: T) -> Self
Source§impl FromStr for GameModsIntermode
impl FromStr for GameModsIntermode
Source§impl Hash for GameModsIntermode
impl Hash for GameModsIntermode
Source§impl<'a> IntoIterator for &'a GameModsIntermode
impl<'a> IntoIterator for &'a GameModsIntermode
Source§impl IntoIterator for GameModsIntermode
impl IntoIterator for GameModsIntermode
Source§fn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Turns GameModsIntermode into an iterator over all contained mods.
Note that the iterator will immediately yield None in case of “NoMod”.
Source§type Item = GameModIntermode
type Item = GameModIntermode
Source§type IntoIter = IntoGameModsIntermodeIter
type IntoIter = IntoGameModsIntermodeIter
Source§impl PartialEq for GameModsIntermode
impl PartialEq for GameModsIntermode
Source§impl<S: Fallible + Allocator + Writer + ?Sized> Serialize<S> for GameModsIntermode
Available on crate feature rkyv only.
impl<S: Fallible + Allocator + Writer + ?Sized> Serialize<S> for GameModsIntermode
rkyv only.Source§impl Serialize for GameModsIntermode
Available on crate feature serde only.
impl Serialize for GameModsIntermode
serde only.Source§impl Sub<GameModIntermode> for GameModsIntermode
impl Sub<GameModIntermode> for GameModsIntermode
Source§fn sub(self, rhs: GameModIntermode) -> Self::Output
fn sub(self, rhs: GameModIntermode) -> Self::Output
Removes a GameModIntermode from the GameModsIntermode
Source§type Output = GameModsIntermode
type Output = GameModsIntermode
- operator.Source§impl SubAssign<GameModIntermode> for GameModsIntermode
impl SubAssign<GameModIntermode> for GameModsIntermode
Source§fn sub_assign(&mut self, rhs: GameModIntermode)
fn sub_assign(&mut self, rhs: GameModIntermode)
Removes a GameModIntermode from the GameModsIntermode
impl Eq for GameModsIntermode
impl StructuralPartialEq for GameModsIntermode
Auto Trait Implementations§
impl Freeze for GameModsIntermode
impl RefUnwindSafe for GameModsIntermode
impl Send for GameModsIntermode
impl Sync for GameModsIntermode
impl Unpin for GameModsIntermode
impl UnwindSafe for GameModsIntermode
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.