pub struct AnimState { /* private fields */ }
Expand description
An AnimState
consists of one or more (currently up to four) state keys,
with each key representing a different state.
For example, a state
could be Active
+ Pressed
or Hover
.
AnimState
s are parsed from the theme file as strings in this format, i.e.
Active + Pressed
, Normal
, Hover
, are all valid. The +
character is used
to concatenate multiple states, and whitespace is ignored. The Normal
key is special and can only be present by itself.
AnimState
s are used in Animated images in order to pick a particular image from a set.
Implementations§
source§impl AnimState
impl AnimState
sourcepub const fn with_two(state1: AnimStateKey, state2: AnimStateKey) -> AnimState
pub const fn with_two(state1: AnimStateKey, state2: AnimStateKey) -> AnimState
Creates an AnimState with the two specified state keys.
sourcepub const fn with_three(
state1: AnimStateKey,
state2: AnimStateKey,
state3: AnimStateKey
) -> AnimState
pub const fn with_three( state1: AnimStateKey, state2: AnimStateKey, state3: AnimStateKey ) -> AnimState
Creates an AnimState with the three specified state keys.
sourcepub const fn with_four(
state1: AnimStateKey,
state2: AnimStateKey,
state3: AnimStateKey,
state4: AnimStateKey
) -> AnimState
pub const fn with_four( state1: AnimStateKey, state2: AnimStateKey, state3: AnimStateKey, state4: AnimStateKey ) -> AnimState
Creates an AnimState with the four specified state keys.
sourcepub const fn new(state: AnimStateKey) -> AnimState
pub const fn new(state: AnimStateKey) -> AnimState
Creates an AnimState consisting of the single specified state
.
sourcepub const fn normal() -> AnimState
pub const fn normal() -> AnimState
Creates an AnimState corresponding to the Normal state with no changes
sourcepub const fn disabled() -> AnimState
pub const fn disabled() -> AnimState
Creates an AnimState consisting of only the Distabled state.
sourcepub fn contains(&self, key: AnimStateKey) -> bool
pub fn contains(&self, key: AnimStateKey) -> bool
Returns whether or not this AnimState
contains the specified key.
sourcepub fn add(&mut self, to_add: AnimStateKey)
pub fn add(&mut self, to_add: AnimStateKey)
Adds the given state key to this AnimState
. Note that
adding Normal
will have no effect.
sourcepub fn remove(&mut self, to_remove: AnimStateKey)
pub fn remove(&mut self, to_remove: AnimStateKey)
Removes the given state key from this AnimState
, if it
is present. Otherwise does nothing. Removing Normal
will have no effect
sourcepub fn set(&mut self, key: AnimStateKey, value: bool)
pub fn set(&mut self, key: AnimStateKey, value: bool)
Sets the specified key
as either present in this AnimState
,
or not, depending on value
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for AnimState
impl<'de> Deserialize<'de> for AnimState
source§fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<AnimState, D::Error>
fn deserialize<D: Deserializer<'de>>( deserializer: D ) -> Result<AnimState, D::Error>
source§impl PartialEq<AnimState> for AnimState
impl PartialEq<AnimState> for AnimState
impl Copy for AnimState
impl Eq for AnimState
impl StructuralEq for AnimState
impl StructuralPartialEq for AnimState
Auto Trait Implementations§
impl RefUnwindSafe for AnimState
impl Send for AnimState
impl Sync for AnimState
impl Unpin for AnimState
impl UnwindSafe for AnimState
Blanket Implementations§
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> Content for Twhere
T: Copy,
impl<T> Content for Twhere T: Copy,
source§unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>where
F: FnOnce(&mut T) -> Result<(), E>,
unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>where F: FnOnce(&mut T) -> Result<(), E>,
Owned
.
User-provided closure F
must only write to and not read from &mut Self
.source§fn get_elements_size() -> usize
fn get_elements_size() -> usize
source§fn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
source§fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
source§fn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.