pub struct HexString(/* private fields */);
Expand description
HexString provides a structured representation of a hex string. It is guaranteed to be a valid string, whether initialized from a string or from a byte vector.
Implementations§
Source§impl HexString
impl HexString
Sourcepub fn from_string(s: &str) -> Result<HexString, HexStringError>
pub fn from_string(s: &str) -> Result<HexString, HexStringError>
Initialize a HexString from an actual hex string. The input string must be of an even length (since it takes two hex characters to represent a byte) and must contain only characters in the range 0-9 and a-f.
This will return an InvalidStringLength error if the length is not even, and InvalidCharacter if any non-hex character is detected.
Sourcepub fn from_bytes(v: &Vec<u8>) -> HexString
pub fn from_bytes(v: &Vec<u8>) -> HexString
Initialize a hex strign from a binary vector. This function cannot fail.
Trait Implementations§
impl StructuralPartialEq for HexString
Auto Trait Implementations§
impl Freeze for HexString
impl RefUnwindSafe for HexString
impl Send for HexString
impl Sync for HexString
impl Unpin for HexString
impl UnwindSafe for HexString
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