pub enum JsonData {
Null,
Bool(bool),
Integer(i64),
Float(f64),
String(String),
Array(Vec<JsonData>),
Object(HashMap<String, JsonData>),
}Expand description
Domain-specific representation of JSON-like data This replaces serde_json::Value to maintain Clean Architecture principles
Variants§
Null
Null value
Bool(bool)
Boolean value
Integer(i64)
Integer value
Float(f64)
Float value (stored as f64 for simplicity)
String(String)
String value
Array(Vec<JsonData>)
Array of JsonData values
Object(HashMap<String, JsonData>)
Object with string keys and JsonData values
Implementations§
Source§impl JsonData
impl JsonData
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if value is integer
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonData>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonData>>
Get mutable array value if this is an array
Sourcepub fn as_object(&self) -> Option<&HashMap<String, JsonData>>
pub fn as_object(&self) -> Option<&HashMap<String, JsonData>>
Get object value if this is an object
Sourcepub fn as_object_mut(&mut self) -> Option<&mut HashMap<String, JsonData>>
pub fn as_object_mut(&mut self) -> Option<&mut HashMap<String, JsonData>>
Get mutable object value if this is an object
Sourcepub fn get_path(&self, path: &str) -> Option<&JsonData>
pub fn get_path(&self, path: &str) -> Option<&JsonData>
Get nested value by path (dot notation)
Sourcepub fn set_path(&mut self, path: &str, value: JsonData) -> bool
pub fn set_path(&mut self, path: &str, value: JsonData) -> bool
Set nested value by path (dot notation)
Sourcepub fn memory_size(&self) -> usize
pub fn memory_size(&self) -> usize
Estimate memory size in bytes
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonData
impl<'de> Deserialize<'de> for JsonData
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for JsonData
impl Serialize for JsonData
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for JsonData
impl StructuralPartialEq for JsonData
Auto Trait Implementations§
impl Freeze for JsonData
impl RefUnwindSafe for JsonData
impl Send for JsonData
impl Sync for JsonData
impl Unpin for JsonData
impl UnwindSafe for JsonData
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more