[][src]Trait uni_components::service::Service

pub trait Service {
    type In: 'static + DeserializeOwned + Serialize;
    type Out: 'static + DeserializeOwned + Serialize;
    pub fn path(&self) -> &str;
pub fn kind(&self) -> Kind;
pub fn from_response(
        &self
    ) -> fn(response: Response) -> Result<Self::Out, Response>; pub fn exec(
        &self,
        parameter: &Self::In,
        slot: &dyn Slot<Result<Self::Out, Response>>
    ) -> Result<(), CallError> { ... } }

Represents server side handler.

It's a good idea to use define_service! instead of trying to implement the trait by yourself.

Associated Types

type In: 'static + DeserializeOwned + Serialize[src]

Input parameter type (There are special limitations for Kind::Get requests

type Out: 'static + DeserializeOwned + Serialize[src]

Output parameter type

Loading content...

Required methods

pub fn path(&self) -> &str[src]

Path to the handler at service

pub fn kind(&self) -> Kind[src]

The kind of requests service will process

pub fn from_response(
    &self
) -> fn(response: Response) -> Result<Self::Out, Response>
[src]

Converter from HTTP response to Service's output type

Loading content...

Provided methods

pub fn exec(
    &self,
    parameter: &Self::In,
    slot: &dyn Slot<Result<Self::Out, Response>>
) -> Result<(), CallError>
[src]

Executes the service. Default implementation call related to the path at server side.

parameter - input parameter

slot - will receive result of the server call

Loading content...

Implementors

Loading content...