#[non_exhaustive]pub struct ArgumentSpec {
pub name: String,
pub description: Option<String>,
pub labels: Vec<ArgumentLabel>,
pub required: bool,
pub source: ArgumentSource,
pub shape: ValueShape,
pub names_the_record: bool,
}Expand description
One argument of an operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringIts name among the arguments’ top-level fields.
description: Option<String>What it is, from the argument type’s documentation unless replaced.
labels: Vec<ArgumentLabel>The words people use for it. Hints for the model, never matched by code.
required: boolWhether an act cannot run without it.
source: ArgumentSourceWhere its value comes from.
shape: ValueShapeThe shape a model gives its value.
names_the_record: boolWhether its value names the record the operation creates, for the acts of the same turn that point at that record before it has a label.
Implementations§
Source§impl ArgumentSpec
impl ArgumentSpec
Sourcepub fn new(name: impl Into<String>, shape: ValueShape) -> ArgumentSpec
pub fn new(name: impl Into<String>, shape: ValueShape) -> ArgumentSpec
An argument named name of shape, user-sourced and optional.
Sourcepub fn label(self, text: impl Into<String>) -> ArgumentSpec
pub fn label(self, text: impl Into<String>) -> ArgumentSpec
Adds a word people use for it, in every language.
Sourcepub fn label_in(
self,
locale: impl Into<Locale>,
text: impl Into<String>,
) -> ArgumentSpec
pub fn label_in( self, locale: impl Into<Locale>, text: impl Into<String>, ) -> ArgumentSpec
Adds a word people use for it in locale.
Sourcepub fn describe(self, description: impl Into<String>) -> ArgumentSpec
pub fn describe(self, description: impl Into<String>) -> ArgumentSpec
Replaces its description.
Sourcepub const fn required(self) -> ArgumentSpec
pub const fn required(self) -> ArgumentSpec
Makes it required.
Sourcepub const fn names_the_record(self) -> ArgumentSpec
pub const fn names_the_record(self) -> ArgumentSpec
Says its value names the record the operation creates.
Sourcepub const fn optional(self) -> ArgumentSpec
pub const fn optional(self) -> ArgumentSpec
Makes it optional.
Sourcepub fn inferred(self) -> ArgumentSpec
pub fn inferred(self) -> ArgumentSpec
Lets the model deduce it from what the user said.
Sourcepub fn from_read(self, read: impl Into<ReadToolKey>) -> ArgumentSpec
pub fn from_read(self, read: impl Into<ReadToolKey>) -> ArgumentSpec
Fills it from read after the plan exists.
Sourcepub fn written(self) -> ArgumentSpec
pub fn written(self) -> ArgumentSpec
Lets the model phrase a text value instead of selecting the user’s words.
Sourcepub fn date_direction(self, direction: DateDirection) -> ArgumentSpec
pub fn date_direction(self, direction: DateDirection) -> ArgumentSpec
Points a date without a year in direction.
Sourcepub fn money(self) -> ArgumentSpec
pub fn money(self) -> ArgumentSpec
Gives it as an amount of money.
Sourcepub fn record(self, workflow: impl Into<WorkflowKey>) -> ArgumentSpec
pub fn record(self, workflow: impl Into<WorkflowKey>) -> ArgumentSpec
Gives it as a record of workflow. The operation receives the record’s
CaseRef fields, with label when the record was in
view, or, for one the same turn opens, the value of the opening operation’s
argument that names it. A record named but not in view is looked
up in the case directory, and asked for again when none or several match.
Sourcepub fn labels_for<'a>(
&'a self,
locale: &'a Locale,
) -> impl Iterator<Item = &'a str> + 'a
pub fn labels_for<'a>( &'a self, locale: &'a Locale, ) -> impl Iterator<Item = &'a str> + 'a
The labels that apply in locale: its own ones first, then the universal ones.
Trait Implementations§
Source§impl Clone for ArgumentSpec
impl Clone for ArgumentSpec
Source§fn clone(&self) -> ArgumentSpec
fn clone(&self) -> ArgumentSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArgumentSpec
impl Debug for ArgumentSpec
Source§impl<'de> Deserialize<'de> for ArgumentSpec
impl<'de> Deserialize<'de> for ArgumentSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ArgumentSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ArgumentSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ArgumentSpec
Source§impl PartialEq for ArgumentSpec
impl PartialEq for ArgumentSpec
Source§impl Serialize for ArgumentSpec
impl Serialize for ArgumentSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ArgumentSpec
Auto Trait Implementations§
impl Freeze for ArgumentSpec
impl RefUnwindSafe for ArgumentSpec
impl Send for ArgumentSpec
impl Sync for ArgumentSpec
impl Unpin for ArgumentSpec
impl UnsafeUnpin for ArgumentSpec
impl UnwindSafe for ArgumentSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.