pub struct FeagiJSON { /* private fields */ }Expand description
A wrapper around serde_json::Value for handling JSON data in FEAGI.
Provides methods to create, parse, and manipulate JSON data with error handling.
Implementations§
Source§impl FeagiJSON
impl FeagiJSON
Sourcepub fn new_empty() -> FeagiJSON
pub fn new_empty() -> FeagiJSON
Creates an empty JSON object.
§Example
use feagi_structures::FeagiJSON;
let json = FeagiJSON::new_empty();
println!("{}", json); // prints: {}Sourcepub fn from_json_string(string: String) -> Result<FeagiJSON, FeagiDataError>
pub fn from_json_string(string: String) -> Result<FeagiJSON, FeagiDataError>
Parses a JSON string into a FeagiJSON wrapper.
§Example
use feagi_structures::FeagiJSON;
let json = FeagiJSON::from_json_string(r#"{"key": "value"}"#.to_string()).unwrap();Sourcepub fn from_json_value(value: Value) -> FeagiJSON
pub fn from_json_value(value: Value) -> FeagiJSON
Creates a FeagiJSON from an existing serde_json::Value.
Sourcepub fn borrow_json_value(&self) -> &Value
pub fn borrow_json_value(&self) -> &Value
Returns a reference to the internal JSON value.
Sourcepub fn update_json_value(&mut self, new_value: Value)
pub fn update_json_value(&mut self, new_value: Value)
Updates the internal JSON value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FeagiJSON
impl RefUnwindSafe for FeagiJSON
impl Send for FeagiJSON
impl Sync for FeagiJSON
impl Unpin for FeagiJSON
impl UnwindSafe for FeagiJSON
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<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