pub trait AsyncSpecification<T: ?Sized + Sync>: Sync {
type Error: Send;
// Required method
fn is_satisfied_by<'candidate>(
&'candidate self,
candidate: &'candidate T,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + 'candidate;
// Provided methods
fn and<Other>(self, other: Other) -> AsyncAnd<Self, Other>
where Self: Sized,
Other: AsyncSpecification<T, Error = Self::Error> { ... }
fn or<Other>(self, other: Other) -> AsyncOr<Self, Other>
where Self: Sized,
Other: AsyncSpecification<T, Error = Self::Error> { ... }
fn not(self) -> AsyncNot<Self>
where Self: Sized { ... }
}Expand description
A runtime-neutral asynchronous rule over a borrowed, Sync candidate.
The returned future is Send, so callers may hand it to an executor that
moves work between threads. This trait uses return-position impl Future
and is therefore not directly dyn-compatible; use
BoxedAsyncSpecification when object-safe dynamic dispatch is required.
No executor or async runtime is selected by this API.
ⓘ
use specification_core::AsyncSpecification;
fn accepts_dynamic(_: &dyn AsyncSpecification<i32, Error = &'static str>) {}Required Associated Types§
Required Methods§
Sourcefn is_satisfied_by<'candidate>(
&'candidate self,
candidate: &'candidate T,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + 'candidate
fn is_satisfied_by<'candidate>( &'candidate self, candidate: &'candidate T, ) -> impl Future<Output = Result<bool, Self::Error>> + Send + 'candidate
Evaluates the rule and returns a Send future with a typed result.
Provided Methods§
Sourcefn and<Other>(self, other: Other) -> AsyncAnd<Self, Other>
fn and<Other>(self, other: Other) -> AsyncAnd<Self, Other>
Combines this rule with other using asynchronous short-circuiting AND.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".