pub struct Hex { /* private fields */ }
Expand description
Hexadecimal Encoding
(a.k.a. Base16)
Implementations§
Source§impl Hex
impl Hex
Sourcepub fn lower_case() -> Hex
pub fn lower_case() -> Hex
Lower case hex: 0-9 a-f
Sourcepub fn upper_case() -> Hex
pub fn upper_case() -> Hex
Upper case hex: 0-9 A-F
Trait Implementations§
Source§impl Encoding for Hex
impl Encoding for Hex
Source§fn encode_to_slice(&self, src: &[u8], dst: &mut [u8]) -> Result<usize, Error>
fn encode_to_slice(&self, src: &[u8], dst: &mut [u8]) -> Result<usize, Error>
Encode the given slice into the destination buffer. Read more
Source§fn encoded_len(&self, bytes: &[u8]) -> usize
fn encoded_len(&self, bytes: &[u8]) -> usize
Calculate the length of the given data after encoding.
Source§fn decode_to_slice(&self, src: &[u8], dst: &mut [u8]) -> Result<usize, Error>
fn decode_to_slice(&self, src: &[u8], dst: &mut [u8]) -> Result<usize, Error>
Decode hexadecimal (upper or lower case) with branchless / secret-independent logic
Source§fn decoded_len(&self, bytes: &[u8]) -> Result<usize, Error>
fn decoded_len(&self, bytes: &[u8]) -> Result<usize, Error>
Calculate the length of the given data after decoding.
Source§fn encode<B: AsRef<[u8]>>(&self, bytes: B) -> Vec<u8> ⓘ
fn encode<B: AsRef<[u8]>>(&self, bytes: B) -> Vec<u8> ⓘ
Encode the given buffer, returning a
Vec<u8>
Source§fn encode_to_writer<B, W>(
&self,
bytes: B,
writer: &mut W,
) -> Result<usize, Error>
fn encode_to_writer<B, W>( &self, bytes: B, writer: &mut W, ) -> Result<usize, Error>
Encode the given slice with this
Encoding
, writing the result to the
supplied io::Write
type, returning the number of bytes written or a Error
.Source§fn encode_to_file<B, P>(&self, bytes: B, path: P) -> Result<File, Error>
fn encode_to_file<B, P>(&self, bytes: B, path: P) -> Result<File, Error>
Encode
self
and write it to a file at the given path, returning the
resulting File
or a Error
. Read moreSource§fn decode<B: AsRef<[u8]>>(&self, encoded_bytes: B) -> Result<Vec<u8>, Error>
fn decode<B: AsRef<[u8]>>(&self, encoded_bytes: B) -> Result<Vec<u8>, Error>
Decode the given buffer, returning a
Vec<u8>
Source§fn decode_from_str<S: AsRef<str>>(&self, encoded: S) -> Result<Vec<u8>, Error>
fn decode_from_str<S: AsRef<str>>(&self, encoded: S) -> Result<Vec<u8>, Error>
Decode the given string-alike type with this
Encoding
, returning the
decoded value or a Error
.Source§impl Ord for Hex
impl Ord for Hex
Source§impl PartialOrd for Hex
impl PartialOrd for Hex
impl Copy for Hex
impl Eq for Hex
impl StructuralPartialEq for Hex
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> 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