Trait tendermint::abci::TypedEvent

source ·
pub trait TypedEvent
where Self: TryFrom<Event>, Event: From<Self>,
{ // Provided method fn into_event(self) -> Event { ... } }
Expand description

A marker trait for types that can be converted to and from Events.

This trait doesn’t make any assumptions about how the conversion is performed, or how the type’s data is encoded in event attributes. Instead, it just declares the conversion methods used to serialize the type to an Event and to deserialize it from an Event, allowing downstream users to declare a single source of truth about how event data is structured.

§Contract

If T: TypedEvent, then:

  • T::try_from(e) == Ok(t) for all t: T, e: Event where Event::from(t).eq_ignoring_index(e) == true.
  • Event::from(T::try_from(e).unwrap()).eq_ignoring_index(e) == true for all e: Event where T::try_from(e) returns Ok(_).

In other words, the conversion methods should round-trip on the attributes, but are not required to preserve the (nondeterministic) index information.

Provided Methods§

source

fn into_event(self) -> Event

Convenience wrapper around Into::into that doesn’t require type inference.

Object Safety§

This trait is not object safe.

Implementors§