Struct der::Encoder [−][src]
DER encoder.
Implementations
impl<'a> Encoder<'a>[src]
pub fn new(bytes: &'a mut [u8]) -> Self[src]
Create a new encoder with the given byte slice as a backing buffer.
pub fn encode<T: Encodable>(&mut self, encodable: &T) -> Result<()>[src]
Encode a value which impls the Encodable trait.
pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>[src]
Return an error with the given ErrorKind, annotating it with
context about where the error occurred.
pub fn is_failed(&self) -> bool[src]
Did the decoding operation fail due to an error?
pub fn finish(self) -> Result<&'a [u8]>[src]
Finish encoding to the buffer, returning a slice containing the data written to the buffer.
pub fn bit_string(&mut self, value: impl TryInto<BitString<'a>>) -> Result<()>[src]
Encode the provided value as an ASN.1 BIT STRING
pub fn generalized_time(
&mut self,
value: impl TryInto<GeneralizedTime>
) -> Result<()>[src]
&mut self,
value: impl TryInto<GeneralizedTime>
) -> Result<()>
Encode the provided value as an ASN.1 GeneralizedTime
pub fn null(&mut self) -> Result<()>[src]
Encode an ASN.1 NULL value.
pub fn octet_string(
&mut self,
value: impl TryInto<OctetString<'a>>
) -> Result<()>[src]
&mut self,
value: impl TryInto<OctetString<'a>>
) -> Result<()>
Encode the provided value as an ASN.1 OCTET STRING
pub fn oid(&mut self, oid: impl TryInto<ObjectIdentifier>) -> Result<()>[src]
oid only.Encode an ASN.1 ObjectIdentifier
pub fn printable_string(
&mut self,
value: impl TryInto<PrintableString<'a>>
) -> Result<()>[src]
&mut self,
value: impl TryInto<PrintableString<'a>>
) -> Result<()>
Encode the provided value as an ASN.1 PrintableString
pub fn utc_time(&mut self, value: impl TryInto<UtcTime>) -> Result<()>[src]
Encode the provided value as an ASN.1 UTCTime
pub fn utf8_string(&mut self, value: impl TryInto<Utf8String<'a>>) -> Result<()>[src]
Encode the provided value as an ASN.1 Utf8String
pub fn sequence(&mut self, encodables: &[&dyn Encodable]) -> Result<()>[src]
Encode a sequence of values which impl the Encodable trait.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Encoder<'a>[src]
impl<'a> Send for Encoder<'a>[src]
impl<'a> Sync for Encoder<'a>[src]
impl<'a> Unpin for Encoder<'a>[src]
impl<'a> !UnwindSafe for Encoder<'a>[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,