pub struct CStringLiteralCodec;Expand description
Encodes and decodes byte-oriented C string literal fragments.
This codec is intended for textual formats that embed byte sequences with C
escapes, such as PK\003\004 or \xd0\xcf. It decodes into raw bytes and
does not require surrounding quotes.
Implementations§
Source§impl CStringLiteralCodec
impl CStringLiteralCodec
Sourcepub fn decode(&self, text: &str) -> CodecResult<Vec<u8>>
pub fn decode(&self, text: &str) -> CodecResult<Vec<u8>>
Decodes a C string literal fragment into bytes.
§Parameters
text: C string literal fragment without surrounding quotes.
§Returns
Decoded raw bytes.
§Errors
Returns CodecError::InvalidEscape for malformed escape sequences,
CodecError::InvalidDigit for malformed fixed-width numeric escapes,
and CodecError::InvalidCharacter for unsupported raw source characters.
Trait Implementations§
Source§impl Clone for CStringLiteralCodec
impl Clone for CStringLiteralCodec
Source§fn clone(&self) -> CStringLiteralCodec
fn clone(&self) -> CStringLiteralCodec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CStringLiteralCodec
impl Debug for CStringLiteralCodec
Source§impl Decoder<str> for CStringLiteralCodec
impl Decoder<str> for CStringLiteralCodec
Source§impl Default for CStringLiteralCodec
impl Default for CStringLiteralCodec
Source§fn default() -> CStringLiteralCodec
fn default() -> CStringLiteralCodec
Returns the “default value” for a type. Read more
Source§impl Encoder<[u8]> for CStringLiteralCodec
impl Encoder<[u8]> for CStringLiteralCodec
Source§impl PartialEq for CStringLiteralCodec
impl PartialEq for CStringLiteralCodec
Source§fn eq(&self, other: &CStringLiteralCodec) -> bool
fn eq(&self, other: &CStringLiteralCodec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for CStringLiteralCodec
impl Eq for CStringLiteralCodec
impl StructuralPartialEq for CStringLiteralCodec
Auto Trait Implementations§
impl Freeze for CStringLiteralCodec
impl RefUnwindSafe for CStringLiteralCodec
impl Send for CStringLiteralCodec
impl Sync for CStringLiteralCodec
impl Unpin for CStringLiteralCodec
impl UnsafeUnpin for CStringLiteralCodec
impl UnwindSafe for CStringLiteralCodec
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