pub enum SadValue {
Bool(bool),
Number(Number),
String(String),
Array(Vec<SadValue>),
Object(IndexMap<String, SadValue>),
}Variants§
Implementations§
Source§impl SadValue
impl SadValue
Sourcepub fn loads(
raw: &[u8],
size: Option<usize>,
kind: Kinds,
) -> Result<Sadder, KERIError>
pub fn loads( raw: &[u8], size: Option<usize>, kind: Kinds, ) -> Result<Sadder, KERIError>
Deserializes raw bytes into a data structure based on the specified kind
§Arguments
raw- Raw bytes to deserializesize- Number of bytes to consume for deserialization (if None, uses all bytes)kind- Serialization format (JSON, MGPK, CBOR)
§Returns
A Result containing either the deserialized data or a KERIError
§Notes
JSON deserialization uses UTF-8 string conversion, while CBOR and MGPK operate directly on bytes
pub fn is_array(&self) -> bool
pub fn is_object(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_i64(&self) -> bool
pub fn is_u64(&self) -> bool
pub fn is_f64(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_i64(&self) -> Option<i64>
pub fn as_u64(&self) -> Option<u64>
pub fn as_f64(&self) -> Option<f64>
pub fn as_str(&self) -> Option<&str>
pub fn as_array(&self) -> Option<&Vec<SadValue>>
pub fn as_object(&self) -> Option<&IndexMap<String, SadValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<SadValue>>
pub fn as_object_mut(&mut self) -> Option<&mut IndexMap<String, SadValue>>
pub fn take_array(self) -> Option<Vec<SadValue>>
pub fn take_object(self) -> Option<IndexMap<String, SadValue>>
pub fn take_string(self) -> Option<String>
pub fn take_bool(self) -> Option<bool>
pub fn take_number(self) -> Option<Number>
pub fn from_bool(b: bool) -> Self
pub fn from_i64(i: i64) -> Self
pub fn from_u64(u: u64) -> Self
pub fn from_f64(f: f64) -> Result<Self, String>
pub fn from_string<S: Into<String>>(s: S) -> Self
pub fn from_array<A: IntoIterator<Item = SadValue>>(a: A) -> Self
pub fn from_object<O: IntoIterator<Item = (String, SadValue)>>(o: O) -> Self
pub fn pointer(&self, path: &str) -> Option<&SadValue>
pub fn pointer_mut(&mut self, path: &str) -> Option<&mut SadValue>
pub fn get<I: Index>(&self, index: I) -> Option<&SadValue>
pub fn get_mut<I: Index>(&mut self, index: I) -> Option<&mut SadValue>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SadValue
impl<'de> Deserialize<'de> for SadValue
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SadValue
Auto Trait Implementations§
impl Freeze for SadValue
impl RefUnwindSafe for SadValue
impl Send for SadValue
impl Sync for SadValue
impl Unpin for SadValue
impl UnsafeUnpin for SadValue
impl UnwindSafe for SadValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.