pub trait BindServer<Kind, T: 'static>: 'static {
type ServiceRequest;
type ServiceResponse;
type ServiceError;
// Required method
fn bind_server<S>(&self, handle: &Handle, io: T, service: S)
where S: Service<Request = Self::ServiceRequest, Response = Self::ServiceResponse, Error = Self::ServiceError> + 'static;
}
Expand description
Binds a service to an I/O object.
This trait is not intended to be implemented directly; instead, implement one of the server protocol traits:
pipeline::ServerProto
multiplex::ServerProto
streaming::pipeline::ServerProto
streaming::multiplex::ServerProto
See the crate documentation for more details on those traits.
The Kind
parameter, in particular, is a zero-sized type used to allow
blanket implementation from the various protocol traits. Any additional
implementations of this trait should use their own zero-sized kind type to
distinguish them.
Required Associated Types§
Sourcetype ServiceRequest
type ServiceRequest
The request type for the service.
Sourcetype ServiceResponse
type ServiceResponse
The response type for the service.
Sourcetype ServiceError
type ServiceError
The error type for the service.
Required Methods§
Sourcefn bind_server<S>(&self, handle: &Handle, io: T, service: S)where
S: Service<Request = Self::ServiceRequest, Response = Self::ServiceResponse, Error = Self::ServiceError> + 'static,
fn bind_server<S>(&self, handle: &Handle, io: T, service: S)where
S: Service<Request = Self::ServiceRequest, Response = Self::ServiceResponse, Error = Self::ServiceError> + 'static,
Bind the service.
This method should spawn a new task on the given event loop handle which provides the given service on the given I/O object.
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.