pub struct TypedEvent<'a, E>where
E: Event,{ /* private fields */ }Expand description
A typed view over an emitted event, combining topic access with a pre-decoded payload.
Implementations§
Source§impl<'a, E> TypedEvent<'a, E>where
E: Event,
impl<'a, E> TypedEvent<'a, E>where
E: Event,
Sourcepub fn new(raw: &'a TxEmittedEvent) -> TypedEvent<'a, E>
pub fn new(raw: &'a TxEmittedEvent) -> TypedEvent<'a, E>
Decode a raw event into a typed view.
When E declares a static topic-0 discriminant (via
Event::signature), the raw event’s topic 0 is verified against it
first, so a payload that merely shares a shape with E cannot be
silently mistyped as E. Panics on a discriminant mismatch, a topic
count differing from Event::num_topics, or payload decode
failure.
Sourcepub fn try_new(raw: &'a TxEmittedEvent) -> Option<TypedEvent<'a, E>>
pub fn try_new(raw: &'a TxEmittedEvent) -> Option<TypedEvent<'a, E>>
Non-panicking twin of new: Some only if the event is
well-formed, its topic 0 matches E’s declared discriminant (when
one exists), its topic count matches Event::num_topics, and its
payload decodes as E::Payload. The probe for scanning event streams
that contain foreign events.
Sourcepub fn num_topics(&self) -> u32
pub fn num_topics(&self) -> u32
Number of topics.
Sourcepub fn raw(&self) -> &EmittedEvent<'a>
pub fn raw(&self) -> &EmittedEvent<'a>
Access the underlying untyped emitted event.