Skip to main content

Event

Struct Event 

Source
pub struct Event<'alloc>(/* private fields */);
Expand description

Normalized mouse input event containing action, button, modifiers, and surface-space position.

Implementations§

Source§

impl<'alloc> Event<'alloc>

Source

pub fn new() -> Result<Self>

Create a new mouse event instance.

Source

pub fn new_with_alloc<'ctx: 'alloc, Ctx>( alloc: &'alloc Allocator<'ctx, Ctx>, ) -> Result<Self>

Create a new mouse event instance with a custom allocator.

See the crate-level documentation regarding custom memory management and lifetimes.

Source

pub fn set_action(&mut self, action: Action) -> &mut Self

Set the event action.

Source

pub fn action(&self) -> Action

Get the event action.

Source

pub fn set_button(&mut self, button: Option<Button>) -> &mut Self

Set the event button.

Source

pub fn button(&self) -> Option<Button>

Get the event button.

Source

pub fn set_mods(&mut self, mods: Mods) -> &mut Self

Set keyboard modifiers held during the event.

Source

pub fn mods(&self) -> Mods

Get keyboard modifiers held during the event.

Source

pub fn set_position(&mut self, pos: Position) -> &mut Self

Set the event position in surface-space pixels.

Source

pub fn position(&self) -> Position

Get the event position in surface-space pixels.

Trait Implementations§

Source§

impl<'alloc> Debug for Event<'alloc>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Event<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'alloc> Freeze for Event<'alloc>

§

impl<'alloc> RefUnwindSafe for Event<'alloc>

§

impl<'alloc> !Send for Event<'alloc>

§

impl<'alloc> !Sync for Event<'alloc>

§

impl<'alloc> Unpin for Event<'alloc>

§

impl<'alloc> UnsafeUnpin for Event<'alloc>

§

impl<'alloc> UnwindSafe for Event<'alloc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.