Skip to main content

ArgumentSpec

Struct ArgumentSpec 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Its 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: bool

Whether an act cannot run without it.

§source: ArgumentSource

Where its value comes from.

§shape: ValueShape

The shape a model gives its value.

§names_the_record: bool

Whether 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

Source

pub fn new(name: impl Into<String>, shape: ValueShape) -> Self

An argument named name of shape, user-sourced and optional.

Source

pub fn label(self, text: impl Into<String>) -> Self

Adds a word people use for it, in every language.

Source

pub fn label_in( self, locale: impl Into<Locale>, text: impl Into<String>, ) -> Self

Adds a word people use for it in locale.

Source

pub fn describe(self, description: impl Into<String>) -> Self

Replaces its description.

Source

pub const fn required(self) -> Self

Makes it required.

Source

pub const fn names_the_record(self) -> Self

Says its value names the record the operation creates.

Source

pub const fn optional(self) -> Self

Makes it optional.

Source

pub fn inferred(self) -> Self

Lets the model deduce it from what the user said.

Source

pub fn from_read(self, read: impl Into<ReadToolKey>) -> Self

Fills it from read after the plan exists.

Source

pub fn written(self) -> Self

Lets the model phrase a text value instead of selecting the user’s words.

Source

pub fn date_direction(self, direction: DateDirection) -> Self

Points a date without a year in direction.

Source

pub fn money(self) -> Self

Gives it as an amount of money.

Source

pub fn record(self, workflow: impl Into<WorkflowKey>) -> Self

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ArgumentSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ArgumentSpec

Source§

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 Eq for ArgumentSpec

Source§

impl PartialEq for ArgumentSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ArgumentSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ArgumentSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.