pub struct Codec { /* private fields */ }Expand description
A codec of one format, built for the machines it serves: its name, the media types of its event records, and its codecs of input events, emitted events and snapshots (each optional: protobuf has no emitted events, and a codec built for a machine without event schemas has no input events).
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn with_media_types(self, media_types: &[&str]) -> Self
pub fn with_media_types(self, media_types: &[&str]) -> Self
Sets the media types its event records are announced by (the first one is what it writes), compared without case.
Sourcepub fn with_events(self, events: Arc<dyn EventCodec>) -> Self
pub fn with_events(self, events: Arc<dyn EventCodec>) -> Self
Sets the codec of input events (the events a machine handles).
Sourcepub fn with_emitted(self, emitted: Arc<dyn EventCodec>) -> Self
pub fn with_emitted(self, emitted: Arc<dyn EventCodec>) -> Self
Sets the codec of emitted events (the events a machine emits).
Sourcepub fn with_snapshots(self, snapshots: Arc<dyn SnapshotCodec>) -> Self
pub fn with_snapshots(self, snapshots: Arc<dyn SnapshotCodec>) -> Self
Sets the codec of snapshots.
Sourcepub fn media_types(&self) -> &[String]
pub fn media_types(&self) -> &[String]
The media types of its event records, in lower case.
Sourcepub fn media_type(&self) -> Option<&str>
pub fn media_type(&self) -> Option<&str>
The media type it writes event records as (its first).
Sourcepub fn events(&self) -> Option<&Arc<dyn EventCodec>>
pub fn events(&self) -> Option<&Arc<dyn EventCodec>>
Its codec of input events, if it has one.
Sourcepub fn emitted(&self) -> Option<&Arc<dyn EventCodec>>
pub fn emitted(&self) -> Option<&Arc<dyn EventCodec>>
Its codec of emitted events, if it has one.
Sourcepub fn snapshots(&self) -> Option<&Arc<dyn SnapshotCodec>>
pub fn snapshots(&self) -> Option<&Arc<dyn SnapshotCodec>>
Its codec of snapshots, if it has one.