Struct lignin::EventBinding [−][src]
pub struct EventBinding<'a, S: ThreadSafety> { pub name: &'a str, pub callback: CallbackRef<S, fn(event: Event)>, pub options: EventBindingOptions, }
Expand description
Vdom
Represents a single DOM event binding with name
and callback
.
Renderers usually should either manage these through EventTarget.addEventListener/….removeEventListener
or ignore them entirely. See web
for a bit more information on that.
Note that the running total of CallbackRegistration
s made can be limited to u32::MAX
or around four billion.
(See callback_registry
for information on how to get around this, if necessary.)
While this limit is likely hard to hit, economizing registrations a little will still (indirectly) improve app performance. Lazily registering callbacks for events only when rendering is also the easiest way for framework developers to use pinning to avoid heap allocations.
Fields
name: &'a str
The event name.
callback: CallbackRef<S, fn(event: Event)>
A callback reference created via CallbackRegistration
.
options: EventBindingOptions
Controls the options parameter of EventTarget.addEventListener().
Note that EventBindingOptions
is created with the [EventBindingOptions.passive()
] flag already enabled!
Implementations
impl<'a, S: ThreadSafety> EventBinding<'a, S>
[src]
impl<'a, S: ThreadSafety> EventBinding<'a, S>
[src]#[must_use]pub fn deanonymize(self) -> Self
[src]
👎 Deprecated: Call of .deanonymize()
on named type.
#[must_use]pub fn deanonymize(self) -> Self
[src]Call of .deanonymize()
on named type.
When called on an opaque type, deanonymizes it into the underlying named type.
Both AutoSafe
and Deanonymize
must be in scope and the method must be called without qualification for this to work.
Calling this method on a named type returns the value and type unchanged and produces a deprecation warning.
impl<'a> EventBinding<'a, ThreadSafe>
[src]
impl<'a> EventBinding<'a, ThreadSafe>
[src]#[must_use]pub fn prefer_thread_safe(self) -> Self
[src]
#[must_use]pub fn prefer_thread_safe(self) -> Self
[src]Gently nudges the compiler to choose the ThreadSafe
version of a value if both are possible.
This method is by value, so it will resolve with higher priority than the by-reference method on the ThreadBound
type.
Note that not all tooling will show the correct overload here, but the compiler knows which to pick.
#[must_use]pub fn prefer_thread_safe_ref(&self) -> &Self
[src]
#[must_use]pub fn prefer_thread_safe_ref(&self) -> &Self
[src]Gently nudges the compiler to choose the ThreadSafe
version of a reference if both are possible.
This method is once by single reference, so it will resolve with higher priority than the twice-by-reference method on the ThreadBound
type.
Note that not all tooling will show the correct overload here, but the compiler knows which to pick.
impl<'a> EventBinding<'a, ThreadBound>
[src]
impl<'a> EventBinding<'a, ThreadBound>
[src]#[must_use]pub fn prefer_thread_safe(&self) -> Self
[src]
#[must_use]pub fn prefer_thread_safe(&self) -> Self
[src]Gently nudges the compiler to choose the ThreadSafe
version of a value if both are is possible.
This method is by reference, so it will resolve with lower priority than the by-value method on the ThreadSafe
type.
Note that not all tooling will show the correct overload here, but the compiler knows which to pick.
#[must_use]pub fn prefer_thread_safe_ref<'b>(self: &&'b Self) -> &'b Self
[src]
#[must_use]pub fn prefer_thread_safe_ref<'b>(self: &&'b Self) -> &'b Self
[src]Gently nudges the compiler to choose the ThreadSafe
version of a reference if both are is possible.
This method is twice by reference, so it will resolve with lower priority than the once-by-reference method on the ThreadSafe
type.
Note that not all tooling will show the correct overload here, but the compiler knows which to pick.
Trait Implementations
impl<'a, S1, S2> Align<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety + Into<S2>,
S2: ThreadSafety,
[src]
impl<'a, S1, S2> Align<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety + Into<S2>,
S2: ThreadSafety,
[src]Not derived from the Into
constraints on $Name
directly since those are too broad.
impl<'a, S> Clone for EventBinding<'a, S> where
S: ThreadSafety,
[src]
impl<'a, S> Clone for EventBinding<'a, S> where
S: ThreadSafety,
[src]impl<'a, V> Deanonymize<EventBinding<'a, ThreadSafe>> for V where
V: Send + Sync + AutoSafe<EventBinding<'a, ThreadBound>>,
[src]
impl<'a, V> Deanonymize<EventBinding<'a, ThreadSafe>> for V where
V: Send + Sync + AutoSafe<EventBinding<'a, ThreadBound>>,
[src]#[must_use]fn deanonymize(self) -> SafeVariant
[src]
#[must_use]fn deanonymize(self) -> SafeVariant
[src]Deanonymize towards a compatible concrete type. Read more
impl<'a, S> Debug for EventBinding<'a, S> where
S: ThreadSafety,
[src]
impl<'a, S> Debug for EventBinding<'a, S> where
S: ThreadSafety,
[src]impl<'a> From<EventBinding<'a, ThreadSafe>> for EventBinding<'a, ThreadBound>
[src]
impl<'a> From<EventBinding<'a, ThreadSafe>> for EventBinding<'a, ThreadBound>
[src]fn from(thread_safe: EventBinding<'a, ThreadSafe>) -> Self
[src]
fn from(thread_safe: EventBinding<'a, ThreadSafe>) -> Self
[src]Performs the conversion.
impl<'a, S> Hash for EventBinding<'a, S> where
S: ThreadSafety,
[src]
impl<'a, S> Hash for EventBinding<'a, S> where
S: ThreadSafety,
[src]impl<'a, S> Ord for EventBinding<'a, S> where
S: ThreadSafety,
[src]
impl<'a, S> Ord for EventBinding<'a, S> where
S: ThreadSafety,
[src]impl<'a, S1, S2> PartialEq<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety,
S2: ThreadSafety,
[src]
impl<'a, S1, S2> PartialEq<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety,
S2: ThreadSafety,
[src]impl<'a, S1, S2> PartialOrd<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety,
S2: ThreadSafety,
[src]
impl<'a, S1, S2> PartialOrd<EventBinding<'a, S2>> for EventBinding<'a, S1> where
S1: ThreadSafety,
S2: ThreadSafety,
[src]fn partial_cmp(&self, other: &EventBinding<'a, S2>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &EventBinding<'a, S2>) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'a, S> Vdom for EventBinding<'a, S> where
S: ThreadSafety,
[src]
impl<'a, S> Vdom for EventBinding<'a, S> where
S: ThreadSafety,
[src]type ThreadSafety = S
type ThreadSafety = S
The ThreadSafety
of the Vdom
type, either ThreadSafe
or ThreadBound
. Read more
impl<'a, S> Copy for EventBinding<'a, S> where
S: ThreadSafety,
[src]
S: ThreadSafety,
impl<'a, S> Eq for EventBinding<'a, S> where
S: ThreadSafety,
[src]
S: ThreadSafety,
Auto Trait Implementations
impl<'a, S> RefUnwindSafe for EventBinding<'a, S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<'a, S> Send for EventBinding<'a, S> where
S: Send,
S: Send,
impl<'a, S> Sync for EventBinding<'a, S> where
S: Sync,
S: Sync,
impl<'a, S> Unpin for EventBinding<'a, S> where
S: Unpin,
S: Unpin,
impl<'a, S> UnwindSafe for EventBinding<'a, S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<'a, S, T> AutoSafe<T> for S where
S: Vdom + Align<T>,
T: Vdom<ThreadSafety = ThreadBound>,
[src]
impl<'a, S, T> AutoSafe<T> for S where
S: Vdom + Align<T>,
T: Vdom<ThreadSafety = ThreadBound>,
[src]#[must_use]fn deanonymize(&self) -> BoundVariant
[src]
#[must_use]fn deanonymize(&self) -> BoundVariant
[src]Deanonymize towards a compatible concrete type. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<'a, V> Deanonymize<EventBinding<'a, ThreadSafe>> for V where
V: Send + Sync + AutoSafe<EventBinding<'a, ThreadBound>>,
[src]
impl<'a, V> Deanonymize<EventBinding<'a, ThreadSafe>> for V where
V: Send + Sync + AutoSafe<EventBinding<'a, ThreadBound>>,
[src]#[must_use]fn deanonymize(self) -> SafeVariant
[src]
#[must_use]fn deanonymize(self) -> SafeVariant
[src]Deanonymize towards a compatible concrete type. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more