pub enum SerializerKind {
MessagePack,
Json,
}Expand description
Serializer kind for checkpoint data
An enum-dispatched serializer that can be stored in checkpoint savers without
requiring dynamic dispatch. Defaults to MessagePack.
Variants§
MessagePack
MessagePack binary format (default, high performance)
Json
JSON text format (human readable, debug friendly)
Implementations§
Source§impl SerializerKind
impl SerializerKind
Sourcepub fn serialize<T: Serialize>(
&self,
value: &T,
) -> Result<Vec<u8>, CheckpointError>
pub fn serialize<T: Serialize>( &self, value: &T, ) -> Result<Vec<u8>, CheckpointError>
Serialize a serializable value to bytes using this serializer
§Errors
Returns CheckpointError::Serialize if serialization fails.
Sourcepub fn deserialize<T: DeserializeOwned>(
&self,
data: &[u8],
) -> Result<T, CheckpointError>
pub fn deserialize<T: DeserializeOwned>( &self, data: &[u8], ) -> Result<T, CheckpointError>
Deserialize bytes to a deserializable type using this serializer
§Errors
Returns CheckpointError::Deserialize if deserialization fails.
Sourcepub const fn format(&self) -> SerializationFormat
pub const fn format(&self) -> SerializationFormat
Get the format identifier
Trait Implementations§
Source§impl Clone for SerializerKind
impl Clone for SerializerKind
Source§fn clone(&self) -> SerializerKind
fn clone(&self) -> SerializerKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SerializerKind
impl Debug for SerializerKind
Source§impl Default for SerializerKind
impl Default for SerializerKind
Source§fn default() -> SerializerKind
fn default() -> SerializerKind
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SerializerKind
impl RefUnwindSafe for SerializerKind
impl Send for SerializerKind
impl Sync for SerializerKind
impl Unpin for SerializerKind
impl UnsafeUnpin for SerializerKind
impl UnwindSafe for SerializerKind
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