Struct wayland_cursor::Cursor
source · pub struct Cursor {
pub(crate) name: String,
pub(crate) images: Vec<CursorImageBuffer>,
pub(crate) total_duration: u32,
}
Expand description
A cursor from a theme. Can contain several images if animated.
Fields§
§name: String
§images: Vec<CursorImageBuffer>
§total_duration: u32
Implementations§
source§impl Cursor
impl Cursor
sourcepub(crate) fn new(
conn: &Connection,
name: &str,
theme: &mut CursorTheme,
images: &[XCursorImage],
size: u32,
) -> Self
pub(crate) fn new( conn: &Connection, name: &str, theme: &mut CursorTheme, images: &[XCursorImage], size: u32, ) -> Self
Construct a new Cursor.
Each of the provided images will be written into theme
.
This will also grow theme.pool
if necessary.
pub(crate) fn nearest_images( size: u32, images: &[XCursorImage], ) -> impl Iterator<Item = &XCursorImage>
sourcepub fn frame_and_duration(&self, millis: u32) -> FrameAndDuration
pub fn frame_and_duration(&self, millis: u32) -> FrameAndDuration
Given a time, calculate which frame to show, and how much time remains until the next frame.
Time will wrap, so if for instance the cursor has an animation lasting 100ms, then calling this function with 5ms and 105ms as input gives the same output.
sourcepub fn image_count(&self) -> usize
pub fn image_count(&self) -> usize
Total number of images forming this cursor animation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cursor
impl !RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl !UnwindSafe for Cursor
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> 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>
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
.source§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
.source§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.source§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.