Skip to main content

Handlers

Struct Handlers 

Source
pub struct Handlers<S> { /* private fields */ }
Expand description

The handler tables produced by building a frame. Dispatch resolves an ActionId / FocusId (from hit_test / focus_at) to its handler and invokes it against the app state.

Implementations§

Source§

impl<S> Handlers<S>

Source

pub fn dispatch(&mut self, id: ActionId, state: &mut S) -> bool

Invoke the tap handler for id. Returns true if one existed and ran.

Source

pub fn dispatch_key( &mut self, id: FocusId, input: &KeyInput, state: &mut S, ) -> bool

Invoke the key handler for focused element id with input. Returns true if one existed and ran.

Source

pub fn dispatch_drag( &mut self, id: DragId, fraction: f64, state: &mut S, ) -> bool

Invoke the drag handler for id with fraction (0..=1 across the element width). Returns true if one existed and ran.

Source

pub fn dispatch_text_pos( &mut self, id: TextPosId, index: usize, extend: bool, state: &mut S, ) -> bool

Invoke the text-pointer handler for id with a resolved byte index and the extend flag. Returns true if one existed and ran.

Source

pub fn dispatch_context( &mut self, id: ContextId, pos: Point, state: &mut S, ) -> bool

Invoke the context (secondary-click) handler for id with the click pos. Returns true if one existed and ran.

Source

pub fn len(&self) -> usize

Total number of registered handlers (taps + keys + drags + text-pointer

  • context).
Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl<S> Debug for Handlers<S>

Source§

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

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

impl<S> Default for Handlers<S>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for Handlers<S>

§

impl<S> !Send for Handlers<S>

§

impl<S> !Sync for Handlers<S>

§

impl<S> !UnwindSafe for Handlers<S>

§

impl<S> Freeze for Handlers<S>

§

impl<S> Unpin for Handlers<S>

§

impl<S> UnsafeUnpin for Handlers<S>

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.