Skip to main content

Procedure

Trait Procedure 

Source
pub trait Procedure: Request {
    type Output;
    type Error;
}
Expand description

What TypeScript can call or subscribe to.

TypeScript calls a procedure by its type’s path, which a generic type’s instantiations share:

ⓘ
#[derive(Deserialize, Input)]
struct Find<T> {
    query: T,
}

#[derive(Deserialize, Input)]
struct Id(String);

// both would be `shop::Find`, sent as `{ query: string }`
impl Procedure for Find<String> { ... }
impl Procedure for Find<Id> { ... }

To call each instantiation, wrap it in a struct of its own:

ⓘ
#[derive(Deserialize, Input)]
struct FindByName(Find<String>);

#[derive(Deserialize, Input)]
struct FindById(Find<Id>);

impl Procedure for FindByName { ... }
impl Procedure for FindById { ... }

Required Associated Types§

Source

type Output

What TypeScript gets on success.

Source

type Error

What TypeScript gets on error.

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§