pub struct ByteString(pub Vec<u8>);
Expand description
A byte string.
A “byte string” in CBOR is an arbitrary length array of bytes.
use cbor_tools::{CborType, ByteString, Encode};
let bytes = [1u8, 2, 3, 4];
let val = ByteString::from(&bytes[..]);
assert_eq!(CborType::from(val).encode(), vec![0x44, 1, 2, 3, 4]);
Tuple Fields§
§0: Vec<u8>
Trait Implementations§
Source§impl Clone for ByteString
impl Clone for ByteString
Source§fn clone(&self) -> ByteString
fn clone(&self) -> ByteString
Returns a duplicate of the value. Read more
1.0.0 · 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 ByteString
impl Debug for ByteString
Source§impl From<ByteString> for CborType
impl From<ByteString> for CborType
Source§fn from(x: ByteString) -> CborType
fn from(x: ByteString) -> CborType
Converts to this type from the input type.
Source§impl<T> From<T> for ByteString
impl<T> From<T> for ByteString
Source§impl PartialEq for ByteString
impl PartialEq for ByteString
impl StructuralPartialEq for ByteString
Auto Trait Implementations§
impl Freeze for ByteString
impl RefUnwindSafe for ByteString
impl Send for ByteString
impl Sync for ByteString
impl Unpin for ByteString
impl UnwindSafe for ByteString
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