Enum CustomCursorSource
pub enum CustomCursorSource {
Image(CursorImage),
Animation(CursorAnimation),
Url {
hotspot_x: u16,
hotspot_y: u16,
url: String,
},
}Expand description
Source for CustomCursor.
See CustomCursor for more details.
Variants§
Image(CursorImage)
Cursor that is backed by RGBA image.
See CustomCursorSource::from_rgba for more.
§Platform-specific
- iOS / Android / Orbital: Unsupported
Animation(CursorAnimation)
Animated cursor.
See CustomCursorSource::from_animation for more.
§Platform-specific
- iOS / Android / Wayland / Windows / X11 / macOS / Orbital: Unsupported
Url
Creates a new cursor from a URL pointing to an image. It uses the url css function, but browser support for image formats is inconsistent. Using PNG is recommended.
§Platform-specific
- iOS / Android / Wayland / Windows / X11 / macOS / Orbital: Unsupported
Implementations§
§impl CustomCursorSource
impl CustomCursorSource
pub fn from_rgba(
rgba: Vec<u8>,
width: u16,
height: u16,
hotspot_x: u16,
hotspot_y: u16,
) -> Result<CustomCursorSource, BadImage>
pub fn from_rgba( rgba: Vec<u8>, width: u16, height: u16, hotspot_x: u16, hotspot_y: u16, ) -> Result<CustomCursorSource, BadImage>
Creates a new cursor from an rgba buffer.
The alpha channel is assumed to be not premultiplied.
pub fn from_animation(
duration: Duration,
cursors: Vec<CustomCursor>,
) -> Result<CustomCursorSource, BadAnimation>
pub fn from_animation( duration: Duration, cursors: Vec<CustomCursor>, ) -> Result<CustomCursorSource, BadAnimation>
Crates a new animated cursor from multiple CustomCursors
Supplied cursors can’t be empty or other animations.
Trait Implementations§
§impl Clone for CustomCursorSource
impl Clone for CustomCursorSource
§fn clone(&self) -> CustomCursorSource
fn clone(&self) -> CustomCursorSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for CustomCursorSource
impl Debug for CustomCursorSource
§impl Hash for CustomCursorSource
impl Hash for CustomCursorSource
§impl PartialEq for CustomCursorSource
impl PartialEq for CustomCursorSource
impl Eq for CustomCursorSource
impl StructuralPartialEq for CustomCursorSource
Auto Trait Implementations§
impl Freeze for CustomCursorSource
impl !RefUnwindSafe for CustomCursorSource
impl Send for CustomCursorSource
impl Sync for CustomCursorSource
impl Unpin for CustomCursorSource
impl !UnwindSafe for CustomCursorSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.