pub enum CborValue {
Integer(i64),
Bytes(Vec<u8>),
Text(String),
Map(BTreeMap<i32, CborValue>),
Array(Vec<CborValue>),
Null,
}
Expand description
CBOR value type for header and claim values.
This enum represents the different types of values that can be stored in token headers and claims. It supports the most common CBOR data types: integers, byte strings, text strings, and maps (which can contain nested values).
§Examples
Creating different types of CBOR values:
use common_access_token::CborValue;
use std::collections::BTreeMap;
// Integer value
let int_value = CborValue::Integer(42);
// Text string value
let text_value = CborValue::Text("Hello, world!".to_string());
// Byte string value
let bytes_value = CborValue::Bytes(vec![0x01, 0x02, 0x03]);
// Map value (nested CBOR map)
let mut map = BTreeMap::new();
map.insert(1, CborValue::Text("nested value".to_string()));
let map_value = CborValue::Map(map);
Variants§
Integer(i64)
Integer value (signed 64-bit integer)
Bytes(Vec<u8>)
Byte string value (binary data)
Text(String)
Text string value (UTF-8 encoded string)
Map(BTreeMap<i32, CborValue>)
Map value (nested CBOR map with integer keys and CBOR values)
Array(Vec<CborValue>)
Array value (list of CBOR values)
Null
Null value
Trait Implementations§
impl StructuralPartialEq for CborValue
Auto Trait Implementations§
impl Freeze for CborValue
impl RefUnwindSafe for CborValue
impl Send for CborValue
impl Sync for CborValue
impl Unpin for CborValue
impl UnwindSafe for CborValue
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