Skip to main content

ViewEvent

Struct ViewEvent 

Source
pub struct ViewEvent<Message> {
    pub redraw: ViewRedraw,
    pub captured: bool,
    pub message: Option<Message>,
}
Expand description

Result of a view update or touch event.

Fields§

§redraw: ViewRedraw

Redraw requested by the view.

§captured: bool

Whether the event was captured by the view.

§message: Option<Message>

Optional application message emitted by the view.

Implementations§

Source§

impl<Message> ViewEvent<Message>

Source

pub const fn none() -> Self

Returns a no-op event.

Examples found in repository?
src/foundation/traits.rs (line 26)
20    fn update(
21        &mut self,
22        _dt_ms: u32,
23        _registration: &ViewRegistration<'text, ViewId, N>,
24        _env: &ViewEnvironment<'_, 'text>,
25    ) -> ViewEvent<Message> {
26        ViewEvent::none()
27    }
Source

pub const fn redraw(redraw: ViewRedraw) -> Self

Creates an event that only requests a redraw.

Examples found in repository?
examples/runtime_shell.rs (line 39)
33    fn handle_touch(
34        &mut self,
35        _touch: TouchEvent,
36        _registration: &ViewRegistration<'static, RootId, 1>,
37        _env: &ViewEnvironment<'_, 'static>,
38    ) -> ViewEvent<()> {
39        ViewEvent::redraw(ViewRedraw::Full)
40    }
More examples
Hide additional examples
examples/uikit_root.rs (line 69)
62    fn update(
63        &mut self,
64        dt_ms: u32,
65        registration: &ViewRegistration<'static, DemoViewId, 2>,
66        _env: &ViewEnvironment<'_, 'static>,
67    ) -> ViewEvent<DemoMessage> {
68        let list = registration.children()[0].frame;
69        ViewEvent::redraw(self.list.tick(dt_ms, list))
70    }
Source

pub const fn captured(self, captured: bool) -> Self

Sets whether the originating event was captured.

Source

pub fn message(self, message: Message) -> Self

Attaches an application message to the event.

Trait Implementations§

Source§

impl<Message: Clone> Clone for ViewEvent<Message>

Source§

fn clone(&self) -> ViewEvent<Message>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Message: Debug> Debug for ViewEvent<Message>

Source§

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

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

impl<Message: PartialEq> PartialEq for ViewEvent<Message>

Source§

fn eq(&self, other: &ViewEvent<Message>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Message: Copy> Copy for ViewEvent<Message>

Source§

impl<Message: Eq> Eq for ViewEvent<Message>

Source§

impl<Message> StructuralPartialEq for ViewEvent<Message>

Auto Trait Implementations§

§

impl<Message> Freeze for ViewEvent<Message>
where Message: Freeze,

§

impl<Message> RefUnwindSafe for ViewEvent<Message>
where Message: RefUnwindSafe,

§

impl<Message> Send for ViewEvent<Message>
where Message: Send,

§

impl<Message> Sync for ViewEvent<Message>
where Message: Sync,

§

impl<Message> Unpin for ViewEvent<Message>
where Message: Unpin,

§

impl<Message> UnsafeUnpin for ViewEvent<Message>
where Message: UnsafeUnpin,

§

impl<Message> UnwindSafe for ViewEvent<Message>
where Message: UnwindSafe,

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.