pub struct Serialized { /* private fields */ }
Expand description
Represents a serialized value, wrapping the underlying serialization and deserialization details, while ensuring that we pass correctly-serialized message throughout the system.
Currently, Serialized passes through to bincode, but in the future we may include content-encoding information to allow for other codecs as well.
Implementations§
Source§impl Serialized
impl Serialized
Sourcepub fn serialize<T: Serialize + Named>(value: &T) -> Result<Self, Error>
pub fn serialize<T: Serialize + Named>(value: &T) -> Result<Self, Error>
Construct a new serialized value by serializing the provided T-typed value.
Sourcepub fn serialize_anon<T: Serialize>(value: &T) -> Result<Self, Error>
pub fn serialize_anon<T: Serialize>(value: &T) -> Result<Self, Error>
Construct a new anonymous (unnamed) serialized value by serializing the provided T-typed value.
Sourcepub fn deserialized<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn deserialized<T: DeserializeOwned>(&self) -> Result<T, Error>
Deserialize a value to the provided type T.
Sourcepub fn transcode_to_json(self) -> Result<Self, Self>
pub fn transcode_to_json(self) -> Result<Self, Self>
Transcode the serialized value to JSON. This operation will succeed if the type hash is embedded in the value, and the corresponding type is available in this binary.
Sourcepub fn dump(&self) -> Result<Value, Error>
pub fn dump(&self) -> Result<Value, Error>
Dump the Serialized message into a JSON value. This will succeed if: 1) the typehash is embedded in the serialized value; 2) the named type is linked into the binary.
Sourcepub fn typename(&self) -> Option<&'static str>
pub fn typename(&self) -> Option<&'static str>
The typename of the serialized value, if available.
Sourcepub fn prefix<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn prefix<T: DeserializeOwned>(&self) -> Result<T, Error>
Deserialize a prefix of the value. This is currently only supported for bincode-serialized values.
Sourcepub fn emplace_prefix<T: Serialize + DeserializeOwned>(
&mut self,
prefix: T,
) -> Result<(), Error>
pub fn emplace_prefix<T: Serialize + DeserializeOwned>( &mut self, prefix: T, ) -> Result<(), Error>
Emplace a new prefix to this value. This is currently only supported for bincode-serialized values.
Trait Implementations§
Source§impl Clone for Serialized
impl Clone for Serialized
Source§fn clone(&self) -> Serialized
fn clone(&self) -> Serialized
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Serialized
impl Debug for Serialized
Source§impl<'de> Deserialize<'de> for Serialized
impl<'de> Deserialize<'de> for Serialized
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Serialized
impl Display for Serialized
Source§impl PartialEq for Serialized
impl PartialEq for Serialized
Source§impl Serialize for Serialized
impl Serialize for Serialized
impl StructuralPartialEq for Serialized
Auto Trait Implementations§
impl !Freeze for Serialized
impl RefUnwindSafe for Serialized
impl Send for Serialized
impl Sync for Serialized
impl Unpin for Serialized
impl UnwindSafe for Serialized
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more