#[non_exhaustive]pub enum CursorIcon {
Default,
Pointer,
Text,
Grab,
Grabbing,
ColResize,
RowResize,
NotAllowed,
}Expand description
The pointer-cursor vocabulary, flat-re-exported from frust-core::event (and
also available through authoring::CursorIcon).
A widget asks for a shape from its own pointer handling —
ctx.set_cursor(CursorIcon::Pointer) — and the desktop shell applies whatever
the pass resolved; the request is per-pass and stateless, so a widget that
stops asking falls back to CursorIcon::Default with nothing to clear. Lifted
flat rather than left inside authoring because a design-system plugin’s
public builder API can name a cursor (a Button::cursor(..) override, a
disabled control asking for CursorIcon::NotAllowed) without being a widget
author itself. #[non_exhaustive]: match with a wildcard arm.
Honoured on desktop only — the mobile shells never read the resolved value, so setting a cursor unconditionally is safe on every platform. The pointer cursor a widget asks the host to display.
A request vocabulary, not a rendering one: platform-neutral names a
widget states its intent in (EventCtx::set_cursor), which a desktop shell
maps onto its own host API — frust-shell-desktop onto winit’s own cursor
icons, the one place any of these names touches a platform. Deliberately
tiny: the shapes a desktop-class design system actually needs, not a full CSS
cursor set.
#[non_exhaustive] from birth, so widening it later cannot break an
out-of-tree match (a shell or design system must carry a wildcard arm and
degrade an unknown request to CursorIcon::Default rather than fail to
compile).
Nothing below a desktop shell honours a request. The mobile shells never read the resolved value — a touch host has no pointer to shape — so a widget may set a cursor unconditionally and get the desktop behaviour where it exists and no behaviour at all where it does not.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Default
The host’s ordinary arrow. The resolved value of any pass in which no
widget asked for anything else, so a widget never has to ask for it to
“give the cursor back” (see EventCtx::set_cursor).
Pointer
The clickable hand: buttons, links, and anything else a press activates.
Text
The text I-beam: editable or selectable text.
Grab
An open hand: this is draggable, and no drag has started yet.
Grabbing
A closed hand: a drag is in progress.
ColResize
A column-resize handle — a divider the pointer moves horizontally.
RowResize
A row-resize handle — a divider the pointer moves vertically.
NotAllowed
The action under the pointer is refused: a disabled control, or a drop target rejecting what is being dragged.
Trait Implementations§
Source§impl Clone for CursorIcon
impl Clone for CursorIcon
Source§fn clone(&self) -> CursorIcon
fn clone(&self) -> CursorIcon
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 CursorIcon
Source§impl Debug for CursorIcon
impl Debug for CursorIcon
Source§impl Default for CursorIcon
impl Default for CursorIcon
Source§fn default() -> CursorIcon
fn default() -> CursorIcon
impl Eq for CursorIcon
Source§impl Hash for CursorIcon
impl Hash for CursorIcon
Source§impl PartialEq for CursorIcon
impl PartialEq for CursorIcon
impl StructuralPartialEq for CursorIcon
Auto Trait Implementations§
impl Freeze for CursorIcon
impl RefUnwindSafe for CursorIcon
impl Send for CursorIcon
impl Sync for CursorIcon
impl Unpin for CursorIcon
impl UnsafeUnpin for CursorIcon
impl UnwindSafe for CursorIcon
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
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.