mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
update doc string
This commit is contained in:
parent
9ddf5a3550
commit
a4c933e56e
@ -238,9 +238,10 @@ Both methods could be combined. (i.e Async response with streaming body)
|
|||||||
## Different return types (Either)
|
## Different return types (Either)
|
||||||
|
|
||||||
Sometimes you need to return different types of responses. For example
|
Sometimes you need to return different types of responses. For example
|
||||||
you can do error check and return error, otherwise return async response.
|
you can do error check and return error and return async response otherwise.
|
||||||
Or any result that requires two different types.
|
Or any result that requires two different types.
|
||||||
For this case [*Either*](../actix_web/enum.Either.html) type can be used.
|
For this case [*Either*](../actix_web/enum.Either.html) type can be used.
|
||||||
|
*Either* allows to combine two different responder types into a single type.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
# extern crate actix_web;
|
# extern crate actix_web;
|
||||||
|
@ -34,7 +34,7 @@ pub trait Responder {
|
|||||||
fn respond_to(self, req: HttpRequest) -> Result<Self::Item, Self::Error>;
|
fn respond_to(self, req: HttpRequest) -> Result<Self::Item, Self::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Combines two different responders types into a single type
|
/// Combines two different responder types into a single type
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_web;
|
/// # extern crate actix_web;
|
||||||
|
Loading…
Reference in New Issue
Block a user