mirror of
https://github.com/fafhrd91/actix-net
synced 2025-03-14 01:52:37 +01:00
Merge pull request #11 from Dowwie/master
added docs for trait Service, trait Transform
This commit is contained in:
commit
ba2901269d
@ -6,9 +6,16 @@ use futures::{Async, Future, IntoFuture, Poll};
|
|||||||
use crate::transform_err::{TransformFromErr, TransformMapInitErr};
|
use crate::transform_err::{TransformFromErr, TransformMapInitErr};
|
||||||
use crate::{IntoNewService, NewService, Service};
|
use crate::{IntoNewService, NewService, Service};
|
||||||
|
|
||||||
/// `Transform` service factory.
|
/// The `Transform` trait defines the interface of a Service factory. `Transform`
|
||||||
|
/// is often implemented for middleware, defining how to manufacture a
|
||||||
|
/// middleware Service. A Service that is manufactured by the factory takes
|
||||||
|
/// the Service that follows it during execution as a parameter, assuming
|
||||||
|
/// ownership of the next Service. A Service can be a variety of types, such
|
||||||
|
/// as (but not limited to) another middleware Service, an extractor Service,
|
||||||
|
/// other helper Services, or the request handler endpoint Service.
|
||||||
|
///
|
||||||
|
/// A Service is created by the factory during server initialization.
|
||||||
///
|
///
|
||||||
/// Transform factory creates service that wraps other services.
|
|
||||||
/// `Config` is a service factory configuration type.
|
/// `Config` is a service factory configuration type.
|
||||||
pub trait Transform<S> {
|
pub trait Transform<S> {
|
||||||
/// Requests handled by the service.
|
/// Requests handled by the service.
|
||||||
@ -33,7 +40,7 @@ pub trait Transform<S> {
|
|||||||
/// The future response value.
|
/// The future response value.
|
||||||
type Future: Future<Item = Self::Transform, Error = Self::InitError>;
|
type Future: Future<Item = Self::Transform, Error = Self::InitError>;
|
||||||
|
|
||||||
/// Create and return a new service value asynchronously.
|
/// Creates and returns a new Service component, asynchronously
|
||||||
fn new_transform(&self, service: S) -> Self::Future;
|
fn new_transform(&self, service: S) -> Self::Future;
|
||||||
|
|
||||||
/// Map this service's factory error to a different error,
|
/// Map this service's factory error to a different error,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user