Struct der::SliceWriter
source · pub struct SliceWriter<'a> { /* private fields */ }
Expand description
Writer
which encodes DER into a mutable output byte slice.
Implementations§
source§impl<'a> SliceWriter<'a>
impl<'a> SliceWriter<'a>
sourcepub fn new(bytes: &'a mut [u8]) -> Self
pub fn new(bytes: &'a mut [u8]) -> Self
Create a new encoder with the given byte slice as a backing buffer.
sourcepub fn encode<T: Encode>(&mut self, encodable: &T) -> Result<()>
pub fn encode<T: Encode>(&mut self, encodable: &T) -> Result<()>
Encode a value which impls the Encode
trait.
sourcepub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>
pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>
Return an error with the given ErrorKind
, annotating it with
context about where the error occurred.
sourcepub fn finish(self) -> Result<&'a [u8]>
pub fn finish(self) -> Result<&'a [u8]>
Finish encoding to the buffer, returning a slice containing the data written to the buffer.
sourcepub fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
value: &T
) -> Result<()>where
T: EncodeValue + Tagged,
pub fn context_specific<T>( &mut self, tag_number: TagNumber, tag_mode: TagMode, value: &T ) -> Result<()>where T: EncodeValue + Tagged,
Encode a CONTEXT-SPECIFIC
field with the provided tag number and mode.
Trait Implementations§
source§impl<'a> Debug for SliceWriter<'a>
impl<'a> Debug for SliceWriter<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for SliceWriter<'a>
impl<'a> Send for SliceWriter<'a>
impl<'a> Sync for SliceWriter<'a>
impl<'a> Unpin for SliceWriter<'a>
impl<'a> !UnwindSafe for SliceWriter<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more