Trait tokio_modbus::server::Service

source ·
pub trait Service {
    type Request;
    type Response: Into<Option<Response>>;
    type Exception: Into<Exception>;
    type Future: Future<Output = Result<Self::Response, Self::Exception>> + Send;

    // Required method
    fn call(&self, req: Self::Request) -> Self::Future;
}
Expand description

A Modbus server service.

Required Associated Types§

source

type Request

Requests handled by the service.

Both tokio_modbus::Request and tokio_modbus::SlaveRequest are possible choices.

source

type Response: Into<Option<Response>>

Responses sent by the service.

Both tokio_modbus::Response and Option<tokio_modbus::Response> are possible choices. The latter allows to selectively ignore requests by not sending a response.

source

type Exception: Into<Exception>

Exceptional responses sent by the service.

Use tokio_modbus::Exception as default.

source

type Future: Future<Output = Result<Self::Response, Self::Exception>> + Send

The future response value.

Required Methods§

source

fn call(&self, req: Self::Request) -> Self::Future

Process the request and return the response asynchronously.

Implementors§

source§

impl<D> Service for D
where D: Deref + ?Sized, D::Target: Service,

§

type Request = <<D as Deref>::Target as Service>::Request

§

type Response = <<D as Deref>::Target as Service>::Response

§

type Exception = <<D as Deref>::Target as Service>::Exception

§

type Future = <<D as Deref>::Target as Service>::Future