pub struct WidgetStates(/* private fields */);Expand description
The set of states a widget is in, as a byte rather than a hash set.
The reference passes a Set<WidgetState>. Eight states fit in eight bits, and a
Copy set with no allocation is what a paint walk that runs every frame wants — it
also means the set can take part in the rebuild hash, which a HashSet could not do
cheaply.
Implementations§
Source§impl WidgetStates
impl WidgetStates
Sourcepub const fn of(state: WidgetState) -> Self
pub const fn of(state: WidgetState) -> Self
The set holding state alone.
Sourcepub const fn with(self, state: WidgetState) -> Self
pub const fn with(self, state: WidgetState) -> Self
This set, plus state.
Sourcepub const fn without(self, state: WidgetState) -> Self
pub const fn without(self, state: WidgetState) -> Self
This set, less state.
Sourcepub const fn set(self, state: WidgetState, on: bool) -> Self
pub const fn set(self, state: WidgetState, on: bool) -> Self
This set, with state present or not according to on — the shape a widget
answering for its own selection wants.
Sourcepub const fn contains(self, state: WidgetState) -> bool
pub const fn contains(self, state: WidgetState) -> bool
Is the widget in this state?
Trait Implementations§
Source§impl BitOr<WidgetState> for WidgetStates
impl BitOr<WidgetState> for WidgetStates
Source§type Output = WidgetStates
type Output = WidgetStates
The resulting type after applying the
| operator.Source§fn bitor(self, state: WidgetState) -> WidgetStates
fn bitor(self, state: WidgetState) -> WidgetStates
Performs the
| operation. Read moreSource§impl Clone for WidgetStates
impl Clone for WidgetStates
impl Copy for WidgetStates
Source§impl Debug for WidgetStates
impl Debug for WidgetStates
Source§impl Default for WidgetStates
impl Default for WidgetStates
impl Eq for WidgetStates
Source§impl From<WidgetState> for WidgetStates
impl From<WidgetState> for WidgetStates
Source§fn from(state: WidgetState) -> Self
fn from(state: WidgetState) -> Self
Converts to this type from the input type.
Source§impl Hash for WidgetStates
impl Hash for WidgetStates
Source§impl PartialEq for WidgetStates
impl PartialEq for WidgetStates
impl StructuralPartialEq for WidgetStates
Auto Trait Implementations§
impl Freeze for WidgetStates
impl RefUnwindSafe for WidgetStates
impl Send for WidgetStates
impl Sync for WidgetStates
impl Unpin for WidgetStates
impl UnsafeUnpin for WidgetStates
impl UnwindSafe for WidgetStates
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
Mutably borrows from an owned value. Read more