Skip to main content

ValueStringCodecRegistration

Type Alias ValueStringCodecRegistration 

Source
pub type ValueStringCodecRegistration = ValueCodecRegistration<ValueStringCodecDescriptor>;
Expand description

A registration for a value codec that encodes to and decodes from strings.

§Examples

use qubit_codec::JsonStringValueCodec;
use qubit_codec::ValueCodecId;
use qubit_codec::ValueCodecRegistration;
use qubit_codec::ValueCodecRegistrationSource;
use qubit_codec::ValueStringCodecDescriptor;
use qubit_codec::ValueStringCodecRegistration;

static DESCRIPTOR: ValueStringCodecDescriptor =
    ValueStringCodecDescriptor::of::<JsonStringValueCodec<u32>, u32>();
let registration: ValueStringCodecRegistration = ValueCodecRegistration::new(
    ValueCodecId::new("example.u32"),
    &DESCRIPTOR,
    ValueCodecRegistrationSource::new("qubit-codec", "doctest", "src/example.rs", 1),
);
assert_eq!(registration.id().as_str(), "example.u32");

Aliased Type§

pub struct ValueStringCodecRegistration { /* private fields */ }