[−][src]Trait bcder::encode::Values
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
Returns the length of the encoded values for the given mode.
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
Encodes the values in the given mode and writes them to target
.
Provided methods
fn explicit(self, tag: Tag) -> Constructed<Self> where
Self: Sized,
Self: Sized,
Converts the encoder into one with an explicit tag.
fn to_captured(&self, mode: Mode) -> Captured
Captures the encoded values in the given mode.
Implementations on Foreign Types
impl<'a, T: Values> Values for &'a T
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T11: Values, T10: Values, T9: Values, T8: Values, T7: Values, T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T11, T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T10: Values, T9: Values, T8: Values, T7: Values, T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T9: Values, T8: Values, T7: Values, T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T8: Values, T7: Values, T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T8, T7, T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T7: Values, T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T7, T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T6: Values, T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T6, T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T5: Values, T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T5, T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T4: Values, T3: Values, T2: Values, T1: Values, T0: Values> Values for (T4, T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T3: Values, T2: Values, T1: Values, T0: Values> Values for (T3, T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T2: Values, T1: Values, T0: Values> Values for (T2, T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T1: Values, T0: Values> Values for (T1, T0)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T0: Values> Values for (T0,)
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<V: Values> Values for Option<V>
[src]
Encoding of an optional value.
This implementation encodes None
as nothing, i.e., as an OPTIONAL
in ASN.1 parlance.
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<V: Values> Values for [V]
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<V: Values> Values for Vec<V>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
Implementors
impl Values for Nothing
[src]
fn encoded_len(&self, _mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
_mode: Mode,
_target: &mut W
) -> Result<(), Error>
[src]
&self,
_mode: Mode,
_target: &mut W
) -> Result<(), Error>
impl Values for Captured
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<L: Values, C: Values, R: Values> Values for Choice3<L, C, R>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<L: Values, R: Values> Values for Choice2<L, R>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<P: PrimitiveContent> Values for Primitive<P>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T> Values for Iter<T> where
T: Clone + IntoIterator,
<T as IntoIterator>::Item: Values,
[src]
T: Clone + IntoIterator,
<T as IntoIterator>::Item: Values,
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T, F, U, V> Values for Slice<T, F, U, V> where
T: AsRef<[U]>,
F: Fn(&U) -> V,
V: Values,
[src]
T: AsRef<[U]>,
F: Fn(&U) -> V,
V: Values,
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<T: AsRef<OctetString>> Values for OctetStringEncoder<T>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
impl<V: Values> Values for Constructed<V>
[src]
fn encoded_len(&self, mode: Mode) -> usize
[src]
fn write_encoded<W: Write>(
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>
[src]
&self,
mode: Mode,
target: &mut W
) -> Result<(), Error>