Struct game_features::Unlockable [−][src]
pub struct Unlockable<U, K, S, I> { pub id: U, pub inner: K, pub is_unlocked: bool, pub unlock_stat_conditions: Vec<StatCondition<S>>, pub unlock_item_conditions: Vec<(I, usize, UseMode)>, pub unlock_dependencies: Vec<U>, }
Expand description
An unlockable element. It can be unlocked to access the inner value if all conditions are met:
StatCondition
s- Item Conditions
- Dependant unlockables were previously unlocked.
Fields
id: U
Expand description
The key of this unlockable.
inner: K
Expand description
The thing we want to unlock access to.
is_unlocked: bool
Expand description
Whether we unlocked it or not.
unlock_stat_conditions: Vec<StatCondition<S>>
Expand description
The stat conditions required to unlock this element.
unlock_item_conditions: Vec<(I, usize, UseMode)>
Expand description
The item conditions required to unlock this element.
unlock_dependencies: Vec<U>
Expand description
A list of other unlockables upon which this one depends. If Unlockable B depends on A, then A must be unlocked before B can be unlocked.
Implementations
impl<U, K, S, I> Unlockable<U, K, S, I>
[src]
impl<U, K, S, I> Unlockable<U, K, S, I>
[src]impl<U, K, S, I> Unlockable<U, K, S, I>
[src]
impl<U, K, S, I> Unlockable<U, K, S, I>
[src]pub fn try_get(&self) -> Option<&K>
[src]
pub fn try_get(&self) -> Option<&K>
[src]Returns Some with the inner value if is_unlocked = true. Otherwise returns None
pub fn try_get_mut(&mut self) -> Option<&mut K>
[src]
pub fn try_get_mut(&mut self) -> Option<&mut K>
[src]Returns Some with the inner value if is_unlocked = true. Otherwise returns None
pub fn set(&mut self, new: K)
[src]
pub fn set(&mut self, new: K)
[src]Inserts a new value without changing the lock. Returns the previous inner value.
pub fn is_unlocked(&self) -> bool
[src]
pub fn is_unlocked(&self) -> bool
[src]Verifies if the inner value is locked.
Trait Implementations
impl<U: Clone, K: Clone, S: Clone, I: Clone> Clone for Unlockable<U, K, S, I>
[src]
impl<U: Clone, K: Clone, S: Clone, I: Clone> Clone for Unlockable<U, K, S, I>
[src]fn clone(&self) -> Unlockable<U, K, S, I>
[src]
fn clone(&self) -> Unlockable<U, K, S, I>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<'de, U, K, S, I> Deserialize<'de> for Unlockable<U, K, S, I> where
U: Deserialize<'de>,
K: Deserialize<'de>,
S: Deserialize<'de>,
I: Deserialize<'de>,
[src]
impl<'de, U, K, S, I> Deserialize<'de> for Unlockable<U, K, S, I> where
U: Deserialize<'de>,
K: Deserialize<'de>,
S: Deserialize<'de>,
I: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<U, K, S, I> RefUnwindSafe for Unlockable<U, K, S, I> where
I: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
U: RefUnwindSafe,
I: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
U: RefUnwindSafe,
impl<U, K, S, I> Send for Unlockable<U, K, S, I> where
I: Send,
K: Send,
S: Send,
U: Send,
I: Send,
K: Send,
S: Send,
U: Send,
impl<U, K, S, I> Sync for Unlockable<U, K, S, I> where
I: Sync,
K: Sync,
S: Sync,
U: Sync,
I: Sync,
K: Sync,
S: Sync,
U: Sync,
impl<U, K, S, I> Unpin for Unlockable<U, K, S, I> where
I: Unpin,
K: Unpin,
S: Unpin,
U: Unpin,
I: Unpin,
K: Unpin,
S: Unpin,
U: Unpin,
impl<U, K, S, I> UnwindSafe for Unlockable<U, K, S, I> where
I: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
U: UnwindSafe,
I: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,