pub struct MarkupEvent {
pub name: &'static str,
pub arguments: &'static [TypeOf],
pub add: MarkupInvoke,
}Expand description
An event that is not a routed event: handlers are attached through
add (or subscribe).
Fields§
§name: &'static str§arguments: &'static [TypeOf]The types of the arguments the event passes to its handlers (sender first, where the event has one).
add: MarkupInvokeSubscribes a handler: (instance, handler), where the handler is a
MarkupDelegate called with the event arguments in untyped form.
Returns the subscription as an untyped Rc<dyn IDisposable>
(subscription_of), or null when the event
offers no way to remove the handler.
Implementations§
Source§impl MarkupEvent
impl MarkupEvent
Sourcepub fn subscribe(
&self,
target: MarkupValue,
handler: MarkupDelegate,
) -> Result<Option<Rc<dyn IDisposable>>, MarkupInvokeError>
pub fn subscribe( &self, target: MarkupValue, handler: MarkupDelegate, ) -> Result<Option<Rc<dyn IDisposable>>, MarkupInvokeError>
Attaches handler to the event of target (the add accessor of the
managed event, EventInfo.AddEventHandler) and returns the
subscription: disposing it removes the handler (the remove
accessor, EventInfo.RemoveEventHandler). Ok(None) when the event
declares no way to remove a handler.
target is the instance in untyped form, as for every member
invoker. The error is the one of add: a target that is not an
instance of the declaring type, or the failure of a fallible
subscription.
Sourcepub fn subscription_of(value: &MarkupValue) -> Option<Rc<dyn IDisposable>>
pub fn subscription_of(value: &MarkupValue) -> Option<Rc<dyn IDisposable>>
The subscription in the result of add: the untyped
Rc<dyn IDisposable> the declaration boxed, None for null.
Sourcepub fn subscription_value(
subscription: impl IntoMarkupSubscription,
) -> MarkupValue
pub fn subscription_value( subscription: impl IntoMarkupSubscription, ) -> MarkupValue
The result of add for what a subscription function returned: the
disposable boxed as an untyped value, null for none. Used by the
events: declarations of the metadata macros, and by a hand-written
add.
Trait Implementations§
Source§impl Clone for MarkupEvent
impl Clone for MarkupEvent
impl Copy for MarkupEvent
Auto Trait Implementations§
impl Freeze for MarkupEvent
impl RefUnwindSafe for MarkupEvent
impl Send for MarkupEvent
impl Sync for MarkupEvent
impl Unpin for MarkupEvent
impl UnsafeUnpin for MarkupEvent
impl UnwindSafe for MarkupEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more