Struct ed25519_dalek::pkcs8::spki::der::SliceWriter
pub struct SliceWriter<'a> { /* private fields */ }
Available on crate feature
pkcs8
only.Expand description
Writer
which encodes DER into a mutable output byte slice.
Implementations§
§impl<'a> SliceWriter<'a>
impl<'a> SliceWriter<'a>
pub fn new(bytes: &'a mut [u8]) -> SliceWriter<'a>
pub fn new(bytes: &'a mut [u8]) -> SliceWriter<'a>
Create a new encoder with the given byte slice as a backing buffer.
pub fn encode<T>(&mut self, encodable: &T) -> Result<(), Error>where
T: Encode,
pub fn encode<T>(&mut self, encodable: &T) -> Result<(), Error>where
T: Encode,
Encode a value which impls the Encode
trait.
pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T, Error>
pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T, Error>
Return an error with the given ErrorKind
, annotating it with
context about where the error occurred.
pub fn finish(self) -> Result<&'a [u8], Error>
pub fn finish(self) -> Result<&'a [u8], Error>
Finish encoding to the buffer, returning a slice containing the data written to the buffer.
pub fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
value: &T
) -> Result<(), Error>where
T: EncodeValue + Tagged,
pub fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
value: &T
) -> Result<(), Error>where
T: EncodeValue + Tagged,
Encode a CONTEXT-SPECIFIC
field with the provided tag number and mode.