Skip to main content

Operation

Trait Operation 

Source
pub trait Operation: Send + 'static {
    type Output: Send + Unpin + 'static;

    // Provided methods
    fn register_types(generator: &mut TypeGen) -> Result
       where Self: Serialize + for<'de> Deserialize<'de>,
             Self::Output: for<'de> Deserialize<'de> { ... }
    fn register_types_facet<'a>(
        generator: &mut TypeRegistry,
    ) -> Result<&mut TypeRegistry, TypeGenError>
       where Self: Facet<'a> + Serialize + for<'de> Deserialize<'de>,
             <Self as Operation>::Output: Facet<'a> + for<'de> Deserialize<'de> { ... }
}
Expand description

Operation trait links together input and output of a side-effect.

You implement Operation on the payload sent by the capability to the shell using [CapabilityContext::request_from_shell].

For example (from crux_http):

impl Operation for HttpRequest {
    type Output = HttpResponse;
}

Required Associated Types§

Source

type Output: Send + Unpin + 'static

Output assigns the type this request results in.

Provided Methods§

Source

fn register_types(generator: &mut TypeGen) -> Result
where Self: Serialize + for<'de> Deserialize<'de>, Self::Output: for<'de> Deserialize<'de>,

Source

fn register_types_facet<'a>( generator: &mut TypeRegistry, ) -> Result<&mut TypeRegistry, TypeGenError>
where Self: Facet<'a> + Serialize + for<'de> Deserialize<'de>, <Self as Operation>::Output: Facet<'a> + for<'de> Deserialize<'de>,

Implementors§