Struct ct_codecs::Hex

source ·
pub struct Hex;

Trait Implementations§

source§

impl Decoder for Hex

source§

fn decode<'t, IN: AsRef<[u8]>>( bin: &'t mut [u8], hex: IN, ignore: Option<&[u8]>, ) -> Result<&'t [u8], Error>

Decode encoded into bin. The output buffer can be larger than required; the returned slice is a view of the buffer with the correct length. ignore is an optional set of characters to ignore.
source§

fn decode_to_vec<IN: AsRef<[u8]>>( encoded: IN, ignore: Option<&[u8]>, ) -> Result<Vec<u8>, Error>

Decode encoded into a Vec<u8>. ignore is an optional set of characters to ignore.
source§

impl Encoder for Hex

source§

fn encoded_len(bin_len: usize) -> Result<usize, Error>

Length of bin_len bytes after encoding.
source§

fn encode<IN: AsRef<[u8]>>(hex: &mut [u8], bin: IN) -> Result<&[u8], Error>

Encode bin into encoded. The output buffer can be larger than required; the returned slice is a view of the buffer with the correct length.
source§

fn encode_to_str<IN: AsRef<[u8]>>( encoded: &mut [u8], bin: IN, ) -> Result<&str, Error>

Encode bin into encoded, return the result as a str. The output buffer can be larger than required; the returned slice is a view of the buffer with the correct length.
source§

fn encode_to_string<IN: AsRef<[u8]>>(bin: IN) -> Result<String, Error>

Encode bin as a String.

Auto Trait Implementations§

§

impl Freeze for Hex

§

impl RefUnwindSafe for Hex

§

impl Send for Hex

§

impl Sync for Hex

§

impl Unpin for Hex

§

impl UnwindSafe for Hex

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.