pub struct Args { /* private fields */ }Expand description
Validated arguments for a function invocation.
Implementations§
Source§impl Args
impl Args
pub fn new(values: BTreeMap<String, Value>) -> Args
pub fn get(&self, name: &str) -> Option<&Value>
pub fn contains(&self, name: &str) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&String, &Value)>
pub fn into_map(self) -> BTreeMap<String, Value>
pub fn require(&self, name: &str) -> Result<&Value, EngineError>
pub fn number(&self, name: &str) -> Result<&Number, EngineError>
pub fn optional_number( &self, name: &str, ) -> Result<Option<&Number>, EngineError>
pub fn text(&self, name: &str) -> Result<&str, EngineError>
pub fn optional_text(&self, name: &str) -> Result<Option<&str>, EngineError>
pub fn bool(&self, name: &str) -> Result<bool, EngineError>
pub fn optional_bool(&self, name: &str) -> Result<Option<bool>, EngineError>
pub fn array(&self, name: &str) -> Result<&[Value], EngineError>
pub fn record( &self, name: &str, ) -> Result<&BTreeMap<String, Value>, EngineError>
pub fn money(&self, name: &str) -> Result<(&Number, &str), EngineError>
pub fn quantity(&self, name: &str) -> Result<(&Number, Dimension), EngineError>
pub fn integer(&self, name: &str) -> Result<BigInt, EngineError>
pub fn optional_integer( &self, name: &str, ) -> Result<Option<BigInt>, EngineError>
Sourcepub fn usize_param(&self, name: &str) -> Result<usize, EngineError>
pub fn usize_param(&self, name: &str) -> Result<usize, EngineError>
Convert an integer argument to usize, rejecting negatives and overflow.
pub fn u32_param(&self, name: &str) -> Result<u32, EngineError>
pub fn u64_param(&self, name: &str) -> Result<u64, EngineError>
Sourcepub fn f64_param(&self, name: &str) -> Result<f64, EngineError>
pub fn f64_param(&self, name: &str) -> Result<f64, EngineError>
Convert a numeric argument to f64. This is an explicit conversion and is recorded by callers when it matters; it never happens for exact results.
pub fn optional_f64(&self, name: &str) -> Result<Option<f64>, EngineError>
pub fn decimal(&self, name: &str) -> Result<Decimal, EngineError>
pub fn optional_decimal( &self, name: &str, ) -> Result<Option<Decimal>, EngineError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Args
impl RefUnwindSafe for Args
impl Send for Args
impl Sync for Args
impl Unpin for Args
impl UnsafeUnpin for Args
impl UnwindSafe for Args
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
Mutably borrows from an owned value. Read more