pub struct AgentData {
pub kind: String,
pub value: AgentValue,
}Fields§
§kind: String§value: AgentValueImplementations§
Source§impl AgentData
impl AgentData
pub fn unit() -> Self
pub fn boolean(value: bool) -> Self
pub fn integer(value: i64) -> Self
pub fn number(value: f64) -> Self
pub fn string(value: impl Into<String>) -> Self
pub fn object(value: AgentValueMap<String, AgentValue>) -> Self
pub fn object_with_kind( kind: impl Into<String>, value: AgentValueMap<String, AgentValue>, ) -> Self
pub fn array(kind: impl Into<String>, value: Vec<AgentValue>) -> Self
pub fn from_value(value: AgentValue) -> Self
pub fn from_json_with_kind( kind: impl Into<String>, value: Value, ) -> Result<Self, AgentError>
pub fn from_json(json_value: Value) -> Result<Self, AgentError>
Sourcepub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, AgentError>
pub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, AgentError>
Create AgentData from any Serialize with automatic kind inference
Sourcepub fn from_serialize_with_kind<T: Serialize>(
kind: impl Into<String>,
value: &T,
) -> Result<Self, AgentError>
pub fn from_serialize_with_kind<T: Serialize>( kind: impl Into<String>, value: &T, ) -> Result<Self, AgentError>
Create AgentData from any Serialize with custom kind
Sourcepub fn to_deserialize<T: for<'de> Deserialize<'de>>(
&self,
) -> Result<T, AgentError>
pub fn to_deserialize<T: for<'de> Deserialize<'de>>( &self, ) -> Result<T, AgentError>
Convert AgentData to a Deserialize
pub fn is_unit(&self) -> bool
pub fn is_boolean(&self) -> bool
pub fn is_integer(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_object(&self) -> bool
pub fn is_array(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_i64(&self) -> Option<i64>
pub fn as_f64(&self) -> Option<f64>
pub fn as_str(&self) -> Option<&str>
pub fn as_object(&self) -> Option<&AgentValueMap<String, AgentValue>>
pub fn as_array(&self) -> Option<&Vec<AgentValue>>
pub fn get(&self, key: &str) -> Option<&AgentValue>
pub fn get_bool(&self, key: &str) -> Option<bool>
pub fn get_i64(&self, key: &str) -> Option<i64>
pub fn get_f64(&self, key: &str) -> Option<f64>
pub fn get_str(&self, key: &str) -> Option<&str>
pub fn get_object( &self, key: &str, ) -> Option<&AgentValueMap<String, AgentValue>>
pub fn get_array(&self, key: &str) -> Option<&Vec<AgentValue>>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentData
impl<'de> Deserialize<'de> for AgentData
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 StructuralPartialEq for AgentData
Auto Trait Implementations§
impl Freeze for AgentData
impl RefUnwindSafe for AgentData
impl Send for AgentData
impl Sync for AgentData
impl Unpin for AgentData
impl UnwindSafe for AgentData
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