Skip to main content

EventMask

Struct EventMask 

Source
pub struct EventMask(/* private fields */);
Expand description

A set of event classes, used to filter events for the run loop and for each Widget.

An event is handled only when its class is in both the run loop’s mask (Engine::set_event_mask) and the receiving Widget’s mask (Widget::event_mask). Combine classes with |.

§Examples

use pushrod::event::EventMask;

let mask = EventMask::POINTER_BUTTONS | EventMask::KEYBOARD;

assert!(mask.contains(EventMask::KEYBOARD));
assert!(!mask.contains(EventMask::SCROLL));
assert!(EventMask::ALL.contains(mask));

Implementations§

Source§

impl EventMask

Source

pub const NONE: EventMask

No classes: nothing is delivered.

Source

pub const POINTER_BUTTONS: EventMask

Mouse button presses and releases (Event::PointerPressed, Event::PointerReleased).

Source

pub const POINTER_MOTION: EventMask

Pointer movement (Event::PointerMoved).

Source

pub const HOVER: EventMask

The pointer entering or leaving a Widget (Event::PointerEntered, Event::PointerExited).

Source

pub const SCROLL: EventMask

Scroll wheel and trackpad scrolling (Event::Scrolled).

Source

pub const KEYBOARD: EventMask

Key presses and releases (Event::KeyPressed, Event::KeyReleased).

Source

pub const TEXT: EventMask

Text input (Event::TextEntered).

Source

pub const FOCUS: EventMask

Keyboard focus changes (Event::FocusGained, Event::FocusLost).

Source

pub const WINDOW: EventMask

Source

pub const LIFECYCLE: EventMask

Widget lifecycle and layout changes (Event::Shown, Event::Resized, Event::Removed, …).

Source

pub const TIMER: EventMask

Timer ticks (Event::Tick). Without it the run loop blocks while idle.

Source

pub const CUSTOM: EventMask

Custom events (Event::Custom) and backend wake-ups.

Source

pub const ENGINE: EventMask

Engine events (Event::Engine). A Widget receives them only with this class in its mask.

Source

pub const ALL: EventMask

Every class.

Source

pub fn contains(self, other: EventMask) -> bool

Returns whether every class in other is in this mask.

§Arguments
  • other - The classes to look for.
§Returns

true if all of other’s classes are present.

Source

pub fn intersects(self, other: EventMask) -> bool

Returns whether this mask and other share at least one class.

§Arguments
  • other - The classes to compare with.
§Returns

true if any class is in both.

Source

pub fn is_empty(self) -> bool

Returns whether the mask holds no classes.

§Returns

true for EventMask::NONE.

Trait Implementations§

Source§

impl BitAnd for EventMask

Source§

fn bitand(self, rhs: EventMask) -> EventMask

Returns the classes present in both masks.

§Arguments
  • rhs - The classes to keep.
§Returns

A mask with only the classes in both.

Source§

type Output = EventMask

The resulting type after applying the & operator.
Source§

impl BitOr for EventMask

Source§

fn bitor(self, rhs: EventMask) -> EventMask

Returns the union of two masks.

§Arguments
  • rhs - The classes to add.
§Returns

A mask with the classes of both.

Source§

type Output = EventMask

The resulting type after applying the | operator.
Source§

impl Clone for EventMask

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EventMask

Source§

impl Debug for EventMask

Source§

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

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

impl Default for EventMask

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EventMask

Source§

impl Hash for EventMask

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Not for EventMask

Source§

fn not(self) -> EventMask

Returns every class not in the mask.

§Returns

The complement of the mask within EventMask::ALL.

Source§

type Output = EventMask

The resulting type after applying the ! operator.
Source§

impl PartialEq for EventMask

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EventMask

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.