Skip to main content

ArgsAccess

Struct ArgsAccess 

Source
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>

Source

pub fn positional(&mut self) -> &'a [ExtensionValue]

Returns the positional arguments in source order and marks them as handled.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for ArgsAccess<'a>

§

impl<'a> RefUnwindSafe for ArgsAccess<'a>

§

impl<'a> Send for ArgsAccess<'a>

§

impl<'a> Sync for ArgsAccess<'a>

§

impl<'a> Unpin for ArgsAccess<'a>

§

impl<'a> UnsafeUnpin for ArgsAccess<'a>

§

impl<'a> UnwindSafe for ArgsAccess<'a>

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.