Trait bcder::encode::Values [−][src]
pub trait Values {
fn encoded_len(&self, mode: Mode) -> usize;
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>;
fn explicit(self, tag: Tag) -> Constructed<Self>
where
Self: Sized,
{ ... }
fn to_captured(&self, mode: Mode) -> Captured { ... }
}Expand description
A type that is a value encoder.
Value encoders know how to encode themselves into a
sequence of BER encoded values. While you can impl this trait for your
type manually, in practice it is often easier to define a method called
encode and let it return some dedicated value encoder type constructed
from the types provided by this module.
A type implementing this trait should encodes itself into one or more BER values. That is, the type becomes the content or part of the content of a constructed value.
Required methods
fn encoded_len(&self, mode: Mode) -> usize
fn encoded_len(&self, mode: Mode) -> usize
Returns the length of the encoded values for the given mode.
Provided methods
fn explicit(self, tag: Tag) -> Constructed<Self> where
Self: Sized,
fn explicit(self, tag: Tag) -> Constructed<Self> where
Self: Sized,
Converts the encoder into one with an explicit tag.
fn to_captured(&self, mode: Mode) -> Captured
fn to_captured(&self, mode: Mode) -> Captured
Captures the encoded values in the given mode.
Implementations on Foreign Types
Encoding of an optional value.
This implementation encodes None as nothing, i.e., as an OPTIONAL
in ASN.1 parlance.