pub struct ArgsAccess<'a> { /* private fields */ }Expand description
ArgsAccess provides a view of the arguments in the text form of an
extension relation or advanced extension.
Positional arguments are available via Self::positional, named arguments
via Self::get_named or Self::expect_named which can do type
conversion as well, and output columns via Self::output_columns.
ArgsAccess tracks which arguments are accessed; when
Explainable::from_args returns, any unaccessed arguments will be raised
as ExtensionError::InvalidArgument errors.
Implementations§
Source§impl<'a> ArgsAccess<'a>
impl<'a> ArgsAccess<'a>
Sourcepub fn positional(&mut self) -> &'a [ExtensionValue]
pub fn positional(&mut self) -> &'a [ExtensionValue]
Returns the positional arguments in source order and marks them as handled.
Sourcepub fn output_columns(&self) -> &'a [ExtensionColumn]
pub fn output_columns(&self) -> &'a [ExtensionColumn]
Returns the output columns for a custom relation.
Output columns are not included in the unhandled-argument check.
Sourcepub fn get_named_arg(&mut self, name: &str) -> Option<&'a ExtensionValue>
pub fn get_named_arg(&mut self, name: &str) -> Option<&'a ExtensionValue>
Returns a named argument without converting it, or None if it is absent.
A present argument is marked as handled.
Sourcepub fn get_named<T>(&mut self, name: &str) -> Result<Option<T>, ExtensionError>
pub fn get_named<T>(&mut self, name: &str) -> Result<Option<T>, ExtensionError>
Returns a named argument converted to T, or None if it is absent.
A present argument is marked as handled.
Sourcepub fn get_named_tuple<T>(
&mut self,
name: &str,
) -> Result<Option<Vec<T>>, ExtensionError>
pub fn get_named_tuple<T>( &mut self, name: &str, ) -> Result<Option<Vec<T>>, ExtensionError>
Fetch the named argument name, with an expected type of
TupleValue, and convert each element to type T.
Returns Ok(None) if the argument is absent. Returns an error if the
argument is not a tuple, or if any element of the tuple fails
conversion.
Sourcepub fn expect_named<T>(&mut self, name: &str) -> Result<T, ExtensionError>
pub fn expect_named<T>(&mut self, name: &str) -> Result<T, ExtensionError>
Returns a required named argument converted to T.
A present argument is marked as handled.