pub enum SqlFunctionArgsRef<'a> {
Star,
List(&'a [Expr]),
Pair(&'a Expr, &'a Expr),
}Expand description
A borrowed view of SQL function arguments.
Self::Pair exposes the operands of Expr::JsonAccess as function
arguments without allocating or changing the parser’s owned AST shape.
Variants§
Star
func(*) — distinct from an empty argument list even though its arity is zero.
List(&'a [Expr])
A contiguous argument list borrowed from FunctionArgs::List.
Pair(&'a Expr, &'a Expr)
Two non-contiguous arguments, used by the JSON access operators.
Implementations§
Source§impl<'a> SqlFunctionArgsRef<'a>
impl<'a> SqlFunctionArgsRef<'a>
Sourcepub const fn len(self) -> usize
pub const fn len(self) -> usize
Return the number of expressions supplied to the function.
func(*) has zero expression arguments. Use Self::is_star when the
distinction between Star and an empty List matters.
Sourcepub fn arity_i32(self) -> i32
pub fn arity_i32(self) -> i32
Return the registry-compatible signed arity, saturating at i32::MAX.
Sourcepub fn get(self, index: usize) -> Option<&'a Expr>
pub fn get(self, index: usize) -> Option<&'a Expr>
Borrow the argument at index, if one exists.
Sourcepub fn iter(
self,
) -> impl DoubleEndedIterator<Item = &'a Expr> + ExactSizeIterator + Clone
pub fn iter( self, ) -> impl DoubleEndedIterator<Item = &'a Expr> + ExactSizeIterator + Clone
Iterate over the argument expressions without allocating.
Sourcepub const fn as_list(self) -> Option<&'a [Expr]>
pub const fn as_list(self) -> Option<&'a [Expr]>
Return the underlying contiguous list, when this view is a list.
Star and Pair return None; callers that only need traversal should
use Self::iter.
Sourcepub fn to_owned(self) -> FunctionArgs
pub fn to_owned(self) -> FunctionArgs
Materialize this borrowed view as the parser’s owned argument type.
Trait Implementations§
Source§impl<'a> Clone for SqlFunctionArgsRef<'a>
impl<'a> Clone for SqlFunctionArgsRef<'a>
Source§fn clone(&self) -> SqlFunctionArgsRef<'a>
fn clone(&self) -> SqlFunctionArgsRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more