pub trait FunctionAssertionProvider: Provider {
// Required methods
fn targets() -> FunctionTarget
where Self: Sized;
fn get_assertions(
&self,
context: &ProviderContext<'_, '_, '_>,
invocation: &InvocationInfo<'_, '_, '_>,
) -> Option<InvocationAssertions>;
}Expand description
Provider for getting additional assertions from function calls.
This allows plugins to specify type narrowing for calls like:
assert($x instanceof Foo)- narrows$xtoFooafter the callAssert::assertIsString($x)- narrows$xtostringafter the call
Required Methods§
Sourcefn targets() -> FunctionTargetwhere
Self: Sized,
fn targets() -> FunctionTargetwhere
Self: Sized,
The functions this provider handles.
Sourcefn get_assertions(
&self,
context: &ProviderContext<'_, '_, '_>,
invocation: &InvocationInfo<'_, '_, '_>,
) -> Option<InvocationAssertions>
fn get_assertions( &self, context: &ProviderContext<'_, '_, '_>, invocation: &InvocationInfo<'_, '_, '_>, ) -> Option<InvocationAssertions>
Get assertions for the invocation.
Returns Some(assertions) if this provider has assertions to add,
None otherwise.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".