pub struct AgentDefinition {
pub kind: String,
pub name: String,
pub title: Option<String>,
pub hide_title: bool,
pub description: Option<String>,
pub category: Option<String>,
pub inputs: Option<Vec<String>>,
pub outputs: Option<Vec<String>>,
pub configs: Option<AgentConfigSpecs>,
pub global_configs: Option<FnvIndexMap<String, AgentConfigSpec>>,
pub native_thread: bool,
pub new_boxed: Option<fn(askit: ASKit, id: String, spec: AgentSpec) -> Result<Box<dyn Agent>, AgentError>>,
}Fields§
§kind: String§name: String§title: Option<String>§hide_title: bool§description: Option<String>§category: Option<String>§inputs: Option<Vec<String>>§outputs: Option<Vec<String>>§configs: Option<AgentConfigSpecs>§global_configs: Option<FnvIndexMap<String, AgentConfigSpec>>§native_thread: bool§new_boxed: Option<fn(askit: ASKit, id: String, spec: AgentSpec) -> Result<Box<dyn Agent>, AgentError>>Implementations§
Source§impl AgentDefinition
impl AgentDefinition
pub fn new( kind: impl Into<String>, name: impl Into<String>, new_boxed: Option<fn(askit: ASKit, id: String, spec: AgentSpec) -> Result<Box<dyn Agent>, AgentError>>, ) -> Self
pub fn title(self, title: &str) -> Self
pub fn hide_title(self) -> Self
pub fn description(self, description: &str) -> Self
pub fn category(self, category: &str) -> Self
pub fn inputs(self, inputs: Vec<&str>) -> Self
pub fn outputs(self, outputs: Vec<&str>) -> Self
pub fn configs(self, configs: Vec<(&str, AgentConfigSpec)>) -> Self
pub fn unit_config(self, key: &str) -> Self
pub fn unit_config_with<F>(self, key: &str, f: F) -> Self
pub fn boolean_config(self, key: &str, default: bool) -> Self
pub fn boolean_config_with<F>(self, key: &str, default: bool, f: F) -> Self
pub fn boolean_config_default(self, key: &str) -> Self
pub fn integer_config(self, key: &str, default: i64) -> Self
pub fn integer_config_with<F>(self, key: &str, default: i64, f: F) -> Self
pub fn integer_config_default(self, key: &str) -> Self
pub fn number_config(self, key: &str, default: f64) -> Self
pub fn number_config_with<F>(self, key: &str, default: f64, f: F) -> Self
pub fn number_config_default(self, key: &str) -> Self
pub fn string_config(self, key: &str, default: impl Into<String>) -> Self
pub fn string_config_with<F>( self, key: &str, default: impl Into<String>, f: F, ) -> Self
pub fn string_config_default(self, key: &str) -> Self
pub fn text_config(self, key: &str, default: impl Into<String>) -> Self
pub fn text_config_with<F>( self, key: &str, default: impl Into<String>, f: F, ) -> Self
pub fn text_config_default(self, key: &str) -> Self
pub fn array_config(self, key: &str, default: impl Into<AgentValue>) -> Self
pub fn array_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, f: F, ) -> Self
pub fn array_config_default(self, key: &str) -> Self
pub fn object_config<V: Into<AgentValue>>(self, key: &str, default: V) -> Self
pub fn object_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, f: F, ) -> Self
pub fn object_config_default(self, key: &str) -> Self
pub fn custom_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, type_: &str, f: F, ) -> Self
pub fn global_configs(self, configs: Vec<(&str, AgentConfigSpec)>) -> Self
pub fn unit_global_config(self, key: &str) -> Self
pub fn unit_global_config_with<F>(self, key: &str, f: F) -> Self
pub fn boolean_global_config(self, key: &str, default: bool) -> Self
pub fn boolean_global_config_with<F>( self, key: &str, default: bool, f: F, ) -> Self
pub fn integer_global_config(self, key: &str, default: i64) -> Self
pub fn integer_global_config_with<F>( self, key: &str, default: i64, f: F, ) -> Self
pub fn number_global_config(self, key: &str, default: f64) -> Self
pub fn number_global_config_with<F>(self, key: &str, default: f64, f: F) -> Self
pub fn string_global_config(self, key: &str, default: impl Into<String>) -> Self
pub fn string_global_config_with<F>( self, key: &str, default: impl Into<String>, f: F, ) -> Self
pub fn text_global_config(self, key: &str, default: impl Into<String>) -> Self
pub fn text_global_config_with<F>( self, key: &str, default: impl Into<String>, f: F, ) -> Self
pub fn array_global_config( self, key: &str, default: impl Into<AgentValue>, ) -> Self
pub fn array_global_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, f: F, ) -> Self
pub fn array_global_config_default(self, key: &str) -> Self
pub fn object_global_config<V: Into<AgentValue>>( self, key: &str, default: V, ) -> Self
pub fn object_global_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, f: F, ) -> Self
pub fn custom_global_config_with<V: Into<AgentValue>, F>( self, key: &str, default: V, type_: &str, f: F, ) -> Self
pub fn use_native_thread(self) -> Self
pub fn to_spec(&self) -> AgentSpec
Trait Implementations§
Source§impl Clone for AgentDefinition
impl Clone for AgentDefinition
Source§fn clone(&self) -> AgentDefinition
fn clone(&self) -> AgentDefinition
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 AgentDefinition
impl Debug for AgentDefinition
Source§impl Default for AgentDefinition
impl Default for AgentDefinition
Source§fn default() -> AgentDefinition
fn default() -> AgentDefinition
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentDefinition
impl<'de> Deserialize<'de> for AgentDefinition
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
Auto Trait Implementations§
impl Freeze for AgentDefinition
impl RefUnwindSafe for AgentDefinition
impl Send for AgentDefinition
impl Sync for AgentDefinition
impl Unpin for AgentDefinition
impl UnwindSafe for AgentDefinition
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> 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, 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