Trait EncodeValue

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

    // Provided method
    fn header(&self) -> Result<Header, Error>
       where Self: Tagged { ... }
}
Available on crate feature pkcs8 only.
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, Error>

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<(), Error>

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

Provided Methods§

Source

fn header(&self) -> Result<Header, Error>
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, Error>

Source§

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

Source§

impl EncodeValue for i8

Source§

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

Source§

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

Source§

impl EncodeValue for i16

Source§

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

Source§

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

Source§

impl EncodeValue for i32

Source§

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

Source§

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

Source§

impl EncodeValue for i64

Source§

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

Source§

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

Source§

impl EncodeValue for i128

Source§

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

Source§

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

Source§

impl EncodeValue for str

Source§

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

Source§

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

Source§

impl EncodeValue for u8

Source§

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

Source§

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

Source§

impl EncodeValue for u16

Source§

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

Source§

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

Source§

impl EncodeValue for u32

Source§

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

Source§

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

Source§

impl EncodeValue for u64

Source§

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

Source§

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

Source§

impl EncodeValue for u128

Source§

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

Source§

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

Source§

impl EncodeValue for ()

Source§

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

Source§

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

Source§

impl EncodeValue for String

Available on crate feature alloc only.
Source§

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

Source§

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

Source§

impl EncodeValue for SystemTime

Available on crate feature std only.
Source§

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

Source§

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

Source§

impl<T> EncodeValue for Box<T>
where T: EncodeValue,

Available on crate feature alloc only.
Source§

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

Source§

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

Source§

impl<T> EncodeValue for Vec<T>
where T: Encode,

Available on crate feature alloc only.
Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§

Source§

impl EncodeValue for BitStringRef<'_>

Source§

impl EncodeValue for ObjectIdentifier

Source§

impl EncodeValue for PrivateKeyInfo<'_>

Source§

impl EncodeValue for BitString

Source§

impl EncodeValue for BmpString

Source§

impl EncodeValue for GeneralizedTime

Source§

impl EncodeValue for Ia5String

Source§

impl EncodeValue for Int

Source§

impl EncodeValue for Null

Source§

impl EncodeValue for OctetString

Source§

impl EncodeValue for OctetStringRef<'_>

Source§

impl EncodeValue for PrintableString

Source§

impl EncodeValue for SequenceRef<'_>

Source§

impl EncodeValue for TeletexString

Source§

impl EncodeValue for Uint

Source§

impl EncodeValue for UtcTime

Source§

impl EncodeValue for Any

Source§

impl EncodeValue for AnyRef<'_>

Source§

impl EncodeValue for DateTime

Source§

impl<'a> EncodeValue for Ia5StringRef<'a>

Source§

impl<'a> EncodeValue for IntRef<'a>

Source§

impl<'a> EncodeValue for PrintableStringRef<'a>

Source§

impl<'a> EncodeValue for TeletexStringRef<'a>

Source§

impl<'a> EncodeValue for UintRef<'a>

Source§

impl<'a> EncodeValue for Utf8StringRef<'a>

Source§

impl<'a> EncodeValue for VideotexStringRef<'a>

Source§

impl<'a, Params, Key> EncodeValue for SubjectPublicKeyInfo<Params, Key>
where Params: Choice<'a> + Encode, Key: Encode,

Source§

impl<'a, T> EncodeValue for ContextSpecificRef<'a, T>
where T: EncodeValue + Tagged,

Source§

impl<'a, T> EncodeValue for SetOfVec<T>
where T: 'a + Decode<'a> + Encode + DerOrd,

Available on crate feature alloc only.
Source§

impl<'a, T> EncodeValue for EncodeValueRef<'a, T>
where T: EncodeValue,

Source§

impl<'a, T, const N: usize> EncodeValue for SetOf<T, N>
where T: 'a + Decode<'a> + Encode + DerOrd,

Source§

impl<Params> EncodeValue for AlgorithmIdentifier<Params>
where Params: Encode,

Source§

impl<T> EncodeValue for ContextSpecific<T>
where T: EncodeValue + Tagged,

Source§

impl<T, const N: usize> EncodeValue for SequenceOf<T, N>
where T: Encode,