pub struct ActionArgs { /* private fields */ }Expand description
Arguments for one invocation, already checked against the action’s declared parameters.
There is no way to build one except through bind or
none, so an action’s builder never has to re-validate: if it
holds an ActionArgs, every required parameter is present and every value
has the declared type. That is what keeps a bad call from becoming a
half-applied edit.
Implementations§
Source§impl ActionArgs
impl ActionArgs
Sourcepub fn from(&self) -> Option<&MadeFrom>
pub fn from(&self) -> Option<&MadeFrom>
The resource this invocation is made from, when it is made from one.
Sourcepub fn bind(
params: &[ActionParam],
supplied: impl IntoIterator<Item = (String, ArgValue)>,
) -> Result<Self, ArgError>
pub fn bind( params: &[ActionParam], supplied: impl IntoIterator<Item = (String, ArgValue)>, ) -> Result<Self, ArgError>
Check supplied against params and bind it.
Fails on the first problem rather than accumulating: the caller has to fix them one at a time anyway, and a partial bind must never reach an action.
Sourcepub fn bind_json(
params: &[ActionParam],
supplied: &Map<String, Value>,
) -> Result<Self, ArgError>
pub fn bind_json( params: &[ActionParam], supplied: &Map<String, Value>, ) -> Result<Self, ArgError>
Bind arguments that arrived as a JSON object — the shape a control socket delivers.
pub fn text(&self, name: &str) -> Option<&str>
Sourcepub fn integer(&self, name: &str) -> Option<i64>
pub fn integer(&self, name: &str) -> Option<i64>
The integer bound to name, where it fits one a caller works in.
Sourcepub fn whole(&self, name: &str) -> Option<u64>
pub fn whole(&self, name: &str) -> Option<u64>
The whole number bound to name, as wide as the id it names.
pub fn array(&self, name: &str) -> Option<&[Value]>
Sourcepub fn number(&self, name: &str) -> Option<f64>
pub fn number(&self, name: &str) -> Option<f64>
The number bound to name, if any. An integer argument widens, matching
ArgValue::satisfies.
pub fn boolean(&self, name: &str) -> Option<bool>
Trait Implementations§
Source§impl Clone for ActionArgs
impl Clone for ActionArgs
Source§impl Debug for ActionArgs
impl Debug for ActionArgs
Source§impl Default for ActionArgs
impl Default for ActionArgs
Source§impl PartialEq for ActionArgs
impl PartialEq for ActionArgs
impl StructuralPartialEq for ActionArgs
Auto Trait Implementations§
impl Forget for ActionArgs
impl Freeze for ActionArgs
impl Move for ActionArgs
impl RefUnwindSafe for ActionArgs
impl Send for ActionArgs
impl Sync for ActionArgs
impl Unpin for ActionArgs
impl UnsafeUnpin for ActionArgs
impl UnwindSafe for ActionArgs
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> ⓘ
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> ⓘ
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 more