pub struct InteractionState {
pub hovered: Option<SourceNodeId>,
pub active: Option<SourceNodeId>,
pub focused: Option<SourceNodeId>,
pub selection: Option<Selection>,
}Expand description
The host’s current interaction snapshot, fed into the lane to drive
dynamic pseudo-classes and answered back by InteractionQuery.
This is the input twin of the read-only InteractionQuery trait: the
host owns input state (which node the pointer is over, which is pressed,
which is focused, the active selection) and hands a snapshot to the lane,
which (a) populates each affected element’s cascade state so :hover /
:active / :focus / :focus-within rules match and restyle, and (b)
answers focus_target() / selection() from the same snapshot — one
source for both the cascade and the queries.
CSS scoping is applied when the snapshot is resolved to element state:
:hover / :active match the target and its ancestors (you hover a
button by hovering its label), :focus matches only the focused element,
and :focus-within matches the focused element and its ancestors.
Fields§
§hovered: Option<SourceNodeId>The node the pointer is currently over (the deepest one), or None.
Drives :hover on it and every ancestor.
active: Option<SourceNodeId>The node currently being pressed (the deepest one), or None.
Drives :active on it and every ancestor.
focused: Option<SourceNodeId>The focused node, or None. Drives :focus on it and :focus-within
on it and every ancestor.
selection: Option<Selection>The active selection, if any. Answered back by InteractionQuery::selection.
Trait Implementations§
Source§impl Clone for InteractionState
impl Clone for InteractionState
Source§fn clone(&self) -> InteractionState
fn clone(&self) -> InteractionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for InteractionState
Source§impl Debug for InteractionState
impl Debug for InteractionState
Source§impl Default for InteractionState
impl Default for InteractionState
Source§fn default() -> InteractionState
fn default() -> InteractionState
Source§impl<'de> Deserialize<'de> for InteractionState
impl<'de> Deserialize<'de> for InteractionState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl MallocSizeOf for InteractionState
impl MallocSizeOf for InteractionState
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl PartialEq for InteractionState
impl PartialEq for InteractionState
Source§impl Serialize for InteractionState
impl Serialize for InteractionState
impl StructuralPartialEq for InteractionState
Auto Trait Implementations§
impl Freeze for InteractionState
impl RefUnwindSafe for InteractionState
impl Send for InteractionState
impl Sync for InteractionState
impl Unpin for InteractionState
impl UnsafeUnpin for InteractionState
impl UnwindSafe for InteractionState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more