Skip to main content

DeserializableEventStream

Trait DeserializableEventStream 

Source
pub trait DeserializableEventStream: Sized {
    type Error;

    // Required methods
    fn deserialize_event(
        event_type: &str,
        frame: &EventFrame<'_>,
    ) -> Result<Option<Self>, Error>;
    fn deserialize_error(
        exception_type: &str,
        frame: &EventFrame<'_>,
    ) -> Result<Option<Self::Error>, Error>;
}
Expand description

A schema-mode event stream union that can be read back from frames.

Implemented by generated code: both methods dispatch on the member name and hand EventFrame::deserializer to the event struct’s schema-guided walker, returning Ok(None) for names the union does not model.

Required Associated Types§

Source

type Error

The generated error type of the stream union, or MessageStreamError when the union models no errors.

Required Methods§

Source

fn deserialize_event( event_type: &str, frame: &EventFrame<'_>, ) -> Result<Option<Self>, Error>

Reads the event named by the frame’s :event-type.

Source

fn deserialize_error( exception_type: &str, frame: &EventFrame<'_>, ) -> Result<Option<Self::Error>, Error>

Reads the error named by the frame’s :exception-type.

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§