pub struct FunctionQuery<'a> {
pub name: Option<Cow<'a, str>>,
pub module_name: Filter<Cow<'a, str>>,
pub type_query: Filter<TypeQuery<'a>>,
pub visibility: Option<Visibility>,
pub inputs: Parameters<'a>,
pub outputs: Parameters<'a>,
pub meta: Filter<FunctionMetaQuery>,
}Expand description
Search filter for functions in a crate::registry::Registry.
Every field is optional and an empty query matches everything.
Three of the fields are a Filter rather than an Option, because the
signature’s own field is optional and a query must be able to ask for its
absence. type_query: Filter::Absent asks for a free function, not a
method, which an Option cannot express.
// A free function called `add`, taking exactly two parameters.
let query = FunctionQuery {
name: Some("add".into()),
module_name: Filter::Matching("lib".into()),
type_query: Filter::Absent,
inputs: Parameters::Exact(vec![Default::default(), Default::default()].into()),
..Default::default()
};Fields§
§name: Option<Cow<'a, str>>Required function name.
module_name: Filter<Cow<'a, str>>Filter on the module the function belongs to.
type_query: Filter<TypeQuery<'a>>Filter on the type the function is a method of.
visibility: Option<Visibility>Required visibility.
inputs: Parameters<'a>Filter on the argument list.
outputs: Parameters<'a>Filter on the result list.
meta: Filter<FunctionMetaQuery>Predicate the function metadata must satisfy.
Implementations§
Source§impl FunctionQuery<'_>
impl FunctionQuery<'_>
Sourcepub fn is_valid(&self, signature: &FunctionSignature) -> bool
pub fn is_valid(&self, signature: &FunctionSignature) -> bool
Returns true when signature satisfies every set field.
Sourcepub fn as_hash(&self) -> u64
pub fn as_hash(&self) -> u64
Hashes the query, which is the key the registry caches results under.
Sourcepub fn to_static(&self) -> FunctionQuery<'static>
pub fn to_static(&self) -> FunctionQuery<'static>
Copies borrowed names into owned ones, so the query can outlive them.
Trait Implementations§
Source§impl<'a> Clone for FunctionQuery<'a>
impl<'a> Clone for FunctionQuery<'a>
Source§fn clone(&self) -> FunctionQuery<'a>
fn clone(&self) -> FunctionQuery<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more