pub enum AgentValue {
Unit,
Boolean(bool),
Integer(i64),
Number(f64),
String(Arc<String>),
Image(Arc<PhotonImage>),
Array(Arc<Vec<AgentValue>>),
Object(Arc<AgentValueMap<String, AgentValue>>),
}Variants§
Unit
Boolean(bool)
Integer(i64)
Number(f64)
String(Arc<String>)
Image(Arc<PhotonImage>)
Array(Arc<Vec<AgentValue>>)
Object(Arc<AgentValueMap<String, AgentValue>>)
Implementations§
Source§impl AgentValue
impl AgentValue
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 image_arc(value: Arc<PhotonImage>) -> Self
pub fn object(value: AgentValueMap<String, AgentValue>) -> Self
pub fn array(value: Vec<AgentValue>) -> Self
pub fn boolean_default() -> Self
pub fn integer_default() -> Self
pub fn number_default() -> Self
pub fn string_default() -> Self
pub fn image_default() -> Self
pub fn array_default() -> Self
pub fn object_default() -> Self
pub fn from_json(value: Value) -> Result<Self, AgentError>
pub fn from_kind_json(kind: &str, value: Value) -> Result<Self, AgentError>
pub fn to_json(&self) -> Value
Sourcepub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, AgentError>
pub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, AgentError>
Create AgentValue from Serialize
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 AgentValue 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_array(&self) -> bool
pub fn is_object(&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<Arc<PhotonImage>>
pub fn as_object(&self) -> Option<&AgentValueMap<String, AgentValue>>
pub fn as_object_mut( &mut self, ) -> Option<&mut AgentValueMap<String, AgentValue>>
pub fn as_array(&self) -> Option<&Vec<AgentValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<AgentValue>>
pub fn get(&self, key: &str) -> Option<&AgentValue>
pub fn get_mut(&mut self, key: &str) -> Option<&mut 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<Arc<PhotonImage>>
pub fn get_object( &self, key: &str, ) -> Option<&AgentValueMap<String, AgentValue>>
pub fn get_object_mut( &mut self, key: &str, ) -> Option<&mut AgentValueMap<String, AgentValue>>
pub fn get_array(&self, key: &str) -> Option<&Vec<AgentValue>>
pub fn get_array_mut(&mut self, key: &str) -> Option<&mut Vec<AgentValue>>
pub fn set(&mut self, key: String, value: AgentValue) -> Result<(), AgentError>
Trait Implementations§
Source§impl Clone for AgentValue
impl Clone for AgentValue
Source§fn clone(&self) -> AgentValue
fn clone(&self) -> AgentValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentValue
impl Debug for AgentValue
Source§impl Default for AgentValue
impl Default for AgentValue
Source§impl<'de> Deserialize<'de> for AgentValue
impl<'de> Deserialize<'de> for AgentValue
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
Source§impl From<&str> for AgentValue
impl From<&str> for AgentValue
Source§impl From<()> for AgentValue
impl From<()> for AgentValue
Source§impl From<String> for AgentValue
impl From<String> for AgentValue
Source§impl From<bool> for AgentValue
impl From<bool> for AgentValue
Source§impl From<f64> for AgentValue
impl From<f64> for AgentValue
Source§impl From<i32> for AgentValue
impl From<i32> for AgentValue
Source§impl From<i64> for AgentValue
impl From<i64> for AgentValue
Source§impl PartialEq for AgentValue
impl PartialEq for AgentValue
Auto Trait Implementations§
impl Freeze for AgentValue
impl RefUnwindSafe for AgentValue
impl Send for AgentValue
impl Sync for AgentValue
impl Unpin for AgentValue
impl UnwindSafe for AgentValue
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