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 image(value: PhotonImage) -> 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_image(&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_image(&self) -> Option<&PhotonImage>
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_image(&self, key: &str) -> Option<&PhotonImage>
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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an
OutOfBounds error is returned which contains
the unclamped color. Read more