penumbra_proto::event

Trait EventDomainType

Source
pub trait EventDomainType: DomainType
where <Self as DomainType>::Proto: ProtoEvent, Error: From<<Self as TryFrom<<Self as DomainType>::Proto>>::Error>,
{ // Provided method fn try_from_event(event: &Event) -> Result<Self> { ... } }
Expand description

An extension trait allowing for easy conversion from events into domain types.

This makes the task of writing code that processes events much more easy, since you can just attempt to parse the event directly into the specific domain type.

Provided Methods§

Source

fn try_from_event(event: &Event) -> Result<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: DomainType> EventDomainType for T
where <T as DomainType>::Proto: ProtoEvent, Error: From<<Self as TryFrom<<Self as DomainType>::Proto>>::Error>,