pub enum Parameters<'a> {
Any,
Prefix(Cow<'a, [FunctionQueryParameter<'a>]>),
Exact(Cow<'a, [FunctionQueryParameter<'a>]>),
}Expand description
Search filter for a function’s parameter list.
Three settings, because “the first two are ints” and “it takes exactly two ints” are different questions. A bare list can only ask one of them.
Self::Prefix rejects a list longer than the function’s. A filter
with no parameter to match cannot be satisfied, so it fails instead of
being ignored.
// Say nothing about the parameters at all.
let any = Parameters::default();
assert!(matches!(any, Parameters::Any));Variants§
Any
Matches any parameter list.
Prefix(Cow<'a, [FunctionQueryParameter<'a>]>)
Matches from the front. The function may take more, but not fewer.
Exact(Cow<'a, [FunctionQueryParameter<'a>]>)
Matches one for one. The function takes exactly these.
Implementations§
Source§impl<'a> Parameters<'a>
impl<'a> Parameters<'a>
Sourcepub fn is_valid(&self, parameters: &[FunctionParameter]) -> bool
pub fn is_valid(&self, parameters: &[FunctionParameter]) -> bool
Returns true when parameters satisfies this filter.
Sourcepub fn queries(&self) -> &[FunctionQueryParameter<'a>]
pub fn queries(&self) -> &[FunctionQueryParameter<'a>]
The filters themselves, empty for Self::Any.
Sourcepub fn to_static(&self) -> Parameters<'static>
pub fn to_static(&self) -> Parameters<'static>
Copies borrowed names into owned ones, so the filter can outlive them.
Trait Implementations§
Source§impl<'a> Clone for Parameters<'a>
impl<'a> Clone for Parameters<'a>
Source§fn clone(&self) -> Parameters<'a>
fn clone(&self) -> Parameters<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for Parameters<'a>
impl<'a> Debug for Parameters<'a>
Source§impl<'a> Default for Parameters<'a>
impl<'a> Default for Parameters<'a>
Source§fn default() -> Parameters<'a>
fn default() -> Parameters<'a>
Returns the “default value” for a type. Read more
Source§impl<'a> From<&'a [FunctionQueryParameter<'a>]> for Parameters<'a>
impl<'a> From<&'a [FunctionQueryParameter<'a>]> for Parameters<'a>
Source§fn from(value: &'a [FunctionQueryParameter<'a>]) -> Self
fn from(value: &'a [FunctionQueryParameter<'a>]) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Cow<'a, [FunctionQueryParameter<'a>]>> for Parameters<'a>
impl<'a> From<Cow<'a, [FunctionQueryParameter<'a>]>> for Parameters<'a>
Source§fn from(value: Cow<'a, [FunctionQueryParameter<'a>]>) -> Self
fn from(value: Cow<'a, [FunctionQueryParameter<'a>]>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Vec<FunctionQueryParameter<'a>>> for Parameters<'a>
A plain list is matched from the front. The function may take more
parameters.
impl<'a> From<Vec<FunctionQueryParameter<'a>>> for Parameters<'a>
A plain list is matched from the front. The function may take more parameters.
Source§fn from(value: Vec<FunctionQueryParameter<'a>>) -> Self
fn from(value: Vec<FunctionQueryParameter<'a>>) -> Self
Converts to this type from the input type.
Source§impl<'a> Hash for Parameters<'a>
impl<'a> Hash for Parameters<'a>
Source§impl<'a> PartialEq for Parameters<'a>
impl<'a> PartialEq for Parameters<'a>
impl<'a> StructuralPartialEq for Parameters<'a>
Auto Trait Implementations§
impl<'a> Freeze for Parameters<'a>
impl<'a> RefUnwindSafe for Parameters<'a>
impl<'a> Send for Parameters<'a>
impl<'a> Sync for Parameters<'a>
impl<'a> Unpin for Parameters<'a>
impl<'a> UnsafeUnpin for Parameters<'a>
impl<'a> UnwindSafe for Parameters<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
Source§fn initialize() -> T
fn initialize() -> T
Returns the initial value of this type.