pub trait Operation:
Sized
+ Send
+ 'static {
type Declaration: OperationDeclaration;
type Resources: Send + Sync + 'static;
type Error: Error + Send + Sync + 'static;
type Context<'a>: Send;
type Endpoints: EndpointSet;
// Required methods
fn initialize<'ctx>(
resources: Arc<Self::Resources>,
context: Self::Context<'ctx>,
) -> impl Future<Output = Result<Self, Self::Error>> + Send;
fn run<'ctx>(
&mut self,
context: Self::Context<'ctx>,
request: &mut Self::Declaration,
endpoints: &mut Self::Endpoints,
) -> impl Future<Output = Result<Response<<Self::Declaration as OperationDeclaration>::Response>, Self::Error>> + Send;
// Provided methods
fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
fn cleanup(
&mut self,
) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
fn transferred(&self) -> bool { ... }
fn classify(_error: &Self::Error) -> FailureKind { ... }
}Required Associated Types§
type Declaration: OperationDeclaration
type Resources: Send + Sync + 'static
type Error: Error + Send + Sync + 'static
type Context<'a>: Send
type Endpoints: EndpointSet
Required Methods§
fn initialize<'ctx>( resources: Arc<Self::Resources>, context: Self::Context<'ctx>, ) -> impl Future<Output = Result<Self, Self::Error>> + Send
fn run<'ctx>( &mut self, context: Self::Context<'ctx>, request: &mut Self::Declaration, endpoints: &mut Self::Endpoints, ) -> impl Future<Output = Result<Response<<Self::Declaration as OperationDeclaration>::Response>, Self::Error>> + Send
Provided Methods§
fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
fn cleanup(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
fn transferred(&self) -> bool
fn classify(_error: &Self::Error) -> FailureKind
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".