[−][src]Struct cbor_data::CborOwned
Implementations
impl CborOwned[src]
pub fn trusting(bytes: impl Into<Vec<u8>>) -> Self[src]
Copy the bytes and wrap for indexing.
No checks on the integrity are made, indexing methods may panic if encoded lengths are out of bound.
If you want to carefully treat data obtained from unreliable sources, prefer
canonical().
pub fn canonical(
bytes: impl AsRef<[u8]>,
scratch_space: Option<&mut Vec<u8>>
) -> Option<Self>[src]
bytes: impl AsRef<[u8]>,
scratch_space: Option<&mut Vec<u8>>
) -> Option<Self>
Copy the bytes while checking for integrity and replacing indefinite (byte) strings with definite ones.
This constructor will go through and decode the whole provided CBOR bytes and write them into a vector, thereby
- retaining only innermost tags
- writing arrays and dicts using indefinite size format
- writing numbers in their smallest form
The used vector can be provided (to reuse previously allocated memory) or newly created. In the former case all contents of the provided argument will be cleared.
pub fn borrow(&self) -> Cbor<'_>[src]
Borrow the underlying bytes for Cbor interpretation.
pub fn as_slice(&self) -> &[u8][src]
A view onto the underlying bytes.
pub fn value(&self) -> Option<CborValue<'_>>[src]
Extract the single value represented by this piece of CBOR.
pub fn index(&self, path: &str) -> Option<CborValue<'_>>[src]
Extract a value by indexing into arrays and dicts, with path elements separated by dot.
The empty string will yield the same as calling value(). If path elements
may contain . then use index_iter().
pub fn index_iter<'b>(
&self,
path: impl IntoIterator<Item = &'b str>
) -> Option<CborValue<'_>>[src]
&self,
path: impl IntoIterator<Item = &'b str>
) -> Option<CborValue<'_>>
Extract a value by indexing into arrays and dicts, with path elements yielded by an iterator.
The empty iterator will yield the same as calling value().
Trait Implementations
impl AsRef<[u8]> for CborOwned[src]
impl Clone for CborOwned[src]
impl Debug for CborOwned[src]
impl PartialEq<CborOwned> for CborOwned[src]
impl StructuralPartialEq for CborOwned[src]
Auto Trait Implementations
impl RefUnwindSafe for CborOwned[src]
impl Send for CborOwned[src]
impl Sync for CborOwned[src]
impl Unpin for CborOwned[src]
impl UnwindSafe for CborOwned[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,