Skip to main content

TransformAttempt

Trait TransformAttempt 

Source
pub trait TransformAttempt:
    Send
    + Sync
    + Clone {
    type TransformRequestIdentifier: Eq + Clone + Hash + Send + Sync + Debug;
    type Identifier: Eq + Clone + Hash + Send + Sync + Debug + Into<Self::TransformRequestIdentifier>;
    type CallCtx: Send;
    type CallArgsType: Send;
    type ReturnCtx: Send + Sync + Clone;
    type ReturnType: Send + Sync + Clone;
    type TransformError: Send + Sync + Clone + Error;
    type SendPackage = (Self::Identifier, Self::CallCtx, Self::CallArgsType);
    type ReturnPackage: Send + Sync + Clone = (Self::Identifier, Self::ReturnCtx, Result<Self::ReturnType, Self::TransformError>);

    // Required methods
    fn request_id(&self) -> Self::TransformRequestIdentifier;
    fn attempt_id(&self) -> Self::Identifier;
    fn new(
        attempt_id: Self::Identifier,
        call_ctx: Self::CallCtx,
        call_val: Self::CallArgsType,
    ) -> Self;
    fn set_return_package(&mut self, return_pkg: Self::ReturnPackage);
    fn from_return_package(
        attempt_id: Self::Identifier,
        return_package: Self::ReturnPackage,
    ) -> Self;
}
Expand description

A trait representing a transformation attempt in the shepherd-rs processing system. Each transformation attempt is an attempt to resolve a TransformRequest and produce an output based on the input provided.

The Input and Output types are generic, associated types, but they are a little more complex than the TransformRequest’s Input and Output types. A TransformAttempt’s Input to includes the TransformRequest’s Input, but also includes a CallCtx, a attempt-specific additional data needed for processing and an Identifier that uniquely identifies the attempt.

Required Associated Types§

Provided Associated Types§

Required Methods§

Source

fn request_id(&self) -> Self::TransformRequestIdentifier

Source

fn attempt_id(&self) -> Self::Identifier

Source

fn new( attempt_id: Self::Identifier, call_ctx: Self::CallCtx, call_val: Self::CallArgsType, ) -> Self

Source

fn set_return_package(&mut self, return_pkg: Self::ReturnPackage)

Source

fn from_return_package( attempt_id: Self::Identifier, return_package: Self::ReturnPackage, ) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§