Skip to main content

StateSetExt

Trait StateSetExt 

Source
pub trait StateSetExt:
    IsA<StateSet>
    + Sealed
    + 'static {
    // Provided methods
    fn add_state(&self, type_: StateType) -> bool { ... }
    fn and_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet> { ... }
    fn clear_states(&self) { ... }
    fn contains_state(&self, type_: StateType) -> bool { ... }
    fn is_empty(&self) -> bool { ... }
    fn or_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet> { ... }
    fn remove_state(&self, type_: StateType) -> bool { ... }
    fn xor_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet> { ... }
}
Expand description

Trait containing all StateSet methods.

§Implementors

StateSet

Provided Methods§

Source

fn add_state(&self, type_: StateType) -> bool

Adds the state of the specified type to the state set if it is not already present.

Note that because an StateSet is a read-only object, this method should be used to add a state to a newly-created set which will then be returned by atk_object_ref_state_set. It should not be used to modify the existing state of an object. See also atk_object_notify_state_change.

§type_

an StateType

§Returns

true if the state for type_ is not already in self.

Source

fn and_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet>

Constructs the intersection of the two sets, returning None if the intersection is empty.

§compare_set

another StateSet

§Returns

a new StateSet which is the intersection of the two sets.

Source

fn clear_states(&self)

Removes all states from the state set.

Source

fn contains_state(&self, type_: StateType) -> bool

Checks whether the state for the specified type is in the specified set.

§type_

an StateType

§Returns

true if type_ is the state type is in self.

Source

fn is_empty(&self) -> bool

Checks whether the state set is empty, i.e. has no states set.

§Returns

true if self has no states set, otherwise false

Source

fn or_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet>

Constructs the union of the two sets.

§compare_set

another StateSet

§Returns

a new StateSet which is the union of the two sets, returning None is empty.

Source

fn remove_state(&self, type_: StateType) -> bool

Removes the state for the specified type from the state set.

Note that because an StateSet is a read-only object, this method should be used to remove a state to a newly-created set which will then be returned by atk_object_ref_state_set. It should not be used to modify the existing state of an object. See also atk_object_notify_state_change.

§type_

an AtkType

§Returns

true if type_ was the state type is in self.

Source

fn xor_sets(&self, compare_set: &impl IsA<StateSet>) -> Option<StateSet>

Constructs the exclusive-or of the two sets, returning None is empty. The set returned by this operation contains the states in exactly one of the two sets.

§compare_set

another StateSet

§Returns

a new StateSet which contains the states which are in exactly one of the two sets.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§