pub struct TypedEncoder<T> { /* private fields */ }Expand description
Typed encoder for converting values into typed symbols.
Implementations§
Source§impl<T: 'static> TypedEncoder<T>
impl<T: 'static> TypedEncoder<T>
Sourcepub fn new(format: SerializationFormat) -> Selfwhere
T: Serialize,
pub fn new(format: SerializationFormat) -> Selfwhere
T: Serialize,
Create a new typed encoder with default config.
Sourcepub fn with_config(config: EncodingConfig, format: SerializationFormat) -> Selfwhere
T: Serialize,
pub fn with_config(config: EncodingConfig, format: SerializationFormat) -> Selfwhere
T: Serialize,
Create a new encoder with custom config.
Sourcepub fn with_serializer(
config: EncodingConfig,
format: SerializationFormat,
serializer: impl Serializer<T> + 'static,
) -> Self
pub fn with_serializer( config: EncodingConfig, format: SerializationFormat, serializer: impl Serializer<T> + 'static, ) -> Self
Create with a custom serializer.
Sourcepub const fn with_version(self, version: u16) -> Self
pub const fn with_version(self, version: u16) -> Self
Select the schema version encoded into subsequent symbols.
Sourcepub fn encode(
&mut self,
object_id: ObjectId,
value: &T,
) -> Result<Vec<TypedSymbol<T>>, EncodingError>
pub fn encode( &mut self, object_id: ObjectId, value: &T, ) -> Result<Vec<TypedSymbol<T>>, EncodingError>
Encode a value into typed symbols.
Sourcepub fn encode_into(
&mut self,
object_id: ObjectId,
value: &T,
set: &mut SymbolSet,
) -> Result<usize, EncodingError>
pub fn encode_into( &mut self, object_id: ObjectId, value: &T, set: &mut SymbolSet, ) -> Result<usize, EncodingError>
Encode into an existing symbol set.
Sourcepub async fn encode_to_sink<S: SymbolSink + Unpin>(
&mut self,
object_id: ObjectId,
value: &T,
sink: &mut S,
) -> Result<usize, EncodingError>
pub async fn encode_to_sink<S: SymbolSink + Unpin>( &mut self, object_id: ObjectId, value: &T, sink: &mut S, ) -> Result<usize, EncodingError>
Encode to a symbol sink.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TypedEncoder<T>
impl<T> !UnwindSafe for TypedEncoder<T>
impl<T> Freeze for TypedEncoder<T>
impl<T> Send for TypedEncoder<T>where
T: Send,
impl<T> Sync for TypedEncoder<T>where
T: Sync,
impl<T> Unpin for TypedEncoder<T>where
T: Unpin,
impl<T> UnsafeUnpin for TypedEncoder<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).