pub struct SerializerCatalog<J> { /* private fields */ }Expand description
Per-journal-type registry with one primary encoder and id-based decoders.
Implementations§
Source§impl<J: 'static> SerializerCatalog<J>
impl<J: 'static> SerializerCatalog<J>
Sourcepub fn new<S>(primary: S) -> Selfwhere
S: PersistenceSerializer<J>,
pub fn new<S>(primary: S) -> Selfwhere
S: PersistenceSerializer<J>,
Creates a catalog whose primary serializer is used by Self::encode.
Sourcepub fn register<S>(&mut self, serializer: S) -> PersistenceResult<()>where
S: PersistenceSerializer<J>,
pub fn register<S>(&mut self, serializer: S) -> PersistenceResult<()>where
S: PersistenceSerializer<J>,
Registers an additional decoder.
Duplicate durable ids are rejected without changing the catalog.
Sourcepub fn with_serializer<S>(self, serializer: S) -> PersistenceResult<Self>where
S: PersistenceSerializer<J>,
pub fn with_serializer<S>(self, serializer: S) -> PersistenceResult<Self>where
S: PersistenceSerializer<J>,
Registers an additional decoder and returns the updated catalog.
Sourcepub fn encode(&self, value: &J) -> PersistenceResult<SerializedPayload>
pub fn encode(&self, value: &J) -> PersistenceResult<SerializedPayload>
Encodes a value with the primary serializer.
Sourcepub fn decode(&self, frame: &SerializedPayload) -> PersistenceResult<J>
pub fn decode(&self, frame: &SerializedPayload) -> PersistenceResult<J>
Decodes a frame by dispatching on its stored serializer id.
Sourcepub fn primary_serializer_id(&self) -> SerializerId
pub fn primary_serializer_id(&self) -> SerializerId
Returns the primary serializer id used for new writes.
Auto Trait Implementations§
impl<J> !RefUnwindSafe for SerializerCatalog<J>
impl<J> !UnwindSafe for SerializerCatalog<J>
impl<J> Freeze for SerializerCatalog<J>where
Box<dyn PersistenceSerializer<J>>: Freeze,
HashMap<SerializerId, Box<dyn PersistenceSerializer<J>>>: Freeze,
impl<J> Send for SerializerCatalog<J>where
Box<dyn PersistenceSerializer<J>>: Send,
HashMap<SerializerId, Box<dyn PersistenceSerializer<J>>>: Send,
impl<J> Sync for SerializerCatalog<J>where
Box<dyn PersistenceSerializer<J>>: Sync,
HashMap<SerializerId, Box<dyn PersistenceSerializer<J>>>: Sync,
impl<J> Unpin for SerializerCatalog<J>where
Box<dyn PersistenceSerializer<J>>: Unpin,
HashMap<SerializerId, Box<dyn PersistenceSerializer<J>>>: Unpin,
impl<J> UnsafeUnpin for SerializerCatalog<J>where
Box<dyn PersistenceSerializer<J>>: UnsafeUnpin,
HashMap<SerializerId, Box<dyn PersistenceSerializer<J>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<S> IntoEventHandlerResult<S> for S
impl<S> IntoEventHandlerResult<S> for S
Source§fn into_event_handler_result(self) -> Result<S, PersistenceError>
fn into_event_handler_result(self) -> Result<S, PersistenceError>
Converts this handler output into the runtime result.
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage