DcMixedFields

Trait DcMixedFields 

Source
pub trait DcMixedFields: DcMixedDecode {
    // Required methods
    fn dc_field_owner() -> &'static str;
    fn encode_dc_field_to(
        &self,
        field: &str,
        target: &mut DcWriter<'_>,
    ) -> Result<()>;

    // Provided methods
    fn encode_dc_field(&self, field: &str, target: &mut DcMstring) -> Result<()> { ... }
    fn encode_dc_map_field(
        &self,
        field: &str,
        target: &mut DcMstring,
        encoding: DcKvMapEncoding,
    ) -> Result<()> { ... }
    fn encode_dc_map_field_to(
        &self,
        field: &str,
        target: &mut DcWriter<'_>,
        encoding: DcKvMapEncoding,
    ) -> Result<()> { ... }
    fn accepts_dc_tag(_tag: u128) -> bool { ... }
    fn encode_fields_with_context(
        &self,
        _mst: &mut DcWriter<'_>,
        _context: &SharedValueContext,
    ) -> Result<()> { ... }
    fn decode_field(
        &mut self,
        _tag: u128,
        _ctx: &mut DcProjectionContext<'_, '_>,
        _node_id: NodeId,
    ) -> Result<bool> { ... }
}
Expand description

Field encoding supplied by tagged-record derives, using inline bindings.

Required Methods§

Source

fn dc_field_owner() -> &'static str

Identifies the record owning the generated field annotations.

Source

fn encode_dc_field_to( &self, field: &str, target: &mut DcWriter<'_>, ) -> Result<()>

Encodes one named field as a new source fragment, including its tag.

§Errors

Returns an error for unknown field names or failed encoding.

Provided Methods§

Source

fn encode_dc_field(&self, field: &str, target: &mut DcMstring) -> Result<()>

Source

fn encode_dc_map_field( &self, field: &str, target: &mut DcMstring, encoding: DcKvMapEncoding, ) -> Result<()>

Source

fn encode_dc_map_field_to( &self, field: &str, target: &mut DcWriter<'_>, encoding: DcKvMapEncoding, ) -> Result<()>

Encodes a keyed field using the source array’s framing.

§Errors

Returns an error if this record does not support keyed field encoding.

Source

fn accepts_dc_tag(_tag: u128) -> bool

Returns whether tag is one of this record’s direct or flattened field tags.

Source

fn encode_fields_with_context( &self, _mst: &mut DcWriter<'_>, _context: &SharedValueContext, ) -> Result<()>

Encodes all fields of this record without wrapping in its outer container.

§Errors

Returns an error if field encoding fails.

Source

fn decode_field( &mut self, _tag: u128, _ctx: &mut DcProjectionContext<'_, '_>, _node_id: NodeId, ) -> Result<bool>

Decodes a single tagged field node into self, returning true if tag matched.

§Errors

Returns an error if decoding the matched field fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§