Trait EncodeValue

Source
pub trait EncodeValue {
    // Required methods
    fn value_len(&self) -> Result<Length>;
    fn encode_value(&self, encoder: &mut impl Writer) -> Result<()>;

    // Provided method
    fn header(&self) -> Result<Header>
       where Self: Tagged { ... }
}
Expand description

Encode the value part of a Tag-Length-Value encoded field, sans the Tag and Length.

Required Methods§

Source

fn value_len(&self) -> Result<Length>

Compute the length of this value (sans Tag+Length header) when encoded as ASN.1 DER.

Source

fn encode_value(&self, encoder: &mut impl Writer) -> Result<()>

Encode value (sans Tag+Length header) as ASN.1 DER using the provided Writer.

Provided Methods§

Source

fn header(&self) -> Result<Header>
where Self: Tagged,

Get the Header used to encode this value.

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.

Implementations on Foreign Types§

Source§

impl EncodeValue for bool

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for i8

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for i16

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for i32

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for i64

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for i128

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for str

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for u8

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for u16

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for u32

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for u64

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for u128

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Source§

impl EncodeValue for ()

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, _writer: &mut impl Writer) -> Result<()>

Source§

impl<T, const N: usize> EncodeValue for [T; N]
where T: Encode,

Source§

fn value_len(&self) -> Result<Length>

Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Implementors§