Skip to main content

TypedEncoder

Struct TypedEncoder 

Source
pub struct TypedEncoder<T> { /* private fields */ }
Expand description

Typed encoder for converting values into typed symbols.

Implementations§

Source§

impl<T: 'static> TypedEncoder<T>

Source

pub fn new(format: SerializationFormat) -> Self
where T: Serialize,

Create a new typed encoder with default config.

Source

pub fn with_config(config: EncodingConfig, format: SerializationFormat) -> Self
where T: Serialize,

Create a new encoder with custom config.

Source

pub fn with_serializer( config: EncodingConfig, format: SerializationFormat, serializer: impl Serializer<T> + 'static, ) -> Self

Create with a custom serializer.

Source

pub const fn with_version(self, version: u16) -> Self

Select the schema version encoded into subsequent symbols.

Source

pub fn encode( &mut self, object_id: ObjectId, value: &T, ) -> Result<Vec<TypedSymbol<T>>, EncodingError>

Encode a value into typed symbols.

Source

pub fn encode_into( &mut self, object_id: ObjectId, value: &T, set: &mut SymbolSet, ) -> Result<usize, EncodingError>

Encode into an existing symbol set.

Source

pub async fn encode_to_sink<S: SymbolSink + Unpin>( &mut self, object_id: ObjectId, value: &T, sink: &mut S, ) -> Result<usize, EncodingError>
where T: Send + Sync,

Encode to a symbol sink.

Trait Implementations§

Source§

impl<T> Debug for TypedEncoder<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V