mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 13:51:50 +01:00
update doc strings
This commit is contained in:
parent
f1d6c61c5c
commit
fa6bc35dbd
13
src/route.rs
13
src/route.rs
@ -32,11 +32,11 @@ pub trait RouteHandler<S>: 'static {
|
|||||||
fn set_prefix(&mut self, _prefix: String) {}
|
fn set_prefix(&mut self, _prefix: String) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Actors with ability to handle http requests
|
/// Actors with ability to handle http requests.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub trait Route: Actor {
|
pub trait Route: Actor {
|
||||||
/// Route shared state. State is shared with all routes within same application and could be
|
/// Shared state. State is shared with all routes within same application
|
||||||
/// accessed with `HttpContext::state()` method.
|
/// and could be accessed with `HttpContext::state()` method.
|
||||||
type State;
|
type State;
|
||||||
|
|
||||||
/// Handle `EXPECT` header. By default respond with `HTTP/1.1 100 Continue`
|
/// Handle `EXPECT` header. By default respond with `HTTP/1.1 100 Continue`
|
||||||
@ -67,9 +67,10 @@ pub trait Route: Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handle incoming request. Route actor can return
|
/// Handle incoming request. Route actor can return
|
||||||
/// result immediately with `Reply::reply` or `Reply::with`.
|
/// result immediately with `Reply::reply`.
|
||||||
/// Actor itself could be returned for handling streaming request/response.
|
/// Actor itself could be returned for handling streaming request/response.
|
||||||
/// In that case `HttpContext::start` and `HttpContext::write` has to be used.
|
/// In that case `HttpContext::start` and `HttpContext::write` has to be used
|
||||||
|
/// for writing response.
|
||||||
fn request(req: HttpRequest, payload: Payload, ctx: &mut Self::Context) -> Reply<Self>;
|
fn request(req: HttpRequest, payload: Payload, ctx: &mut Self::Context) -> Reply<Self>;
|
||||||
|
|
||||||
/// This method creates `RouteFactory` for this actor.
|
/// This method creates `RouteFactory` for this actor.
|
||||||
@ -99,7 +100,7 @@ impl<A, S> RouteHandler<S> for RouteFactory<A, S>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Simple route handler
|
/// Fn() route handler
|
||||||
pub(crate)
|
pub(crate)
|
||||||
struct FnHandler<S, R, F>
|
struct FnHandler<S, R, F>
|
||||||
where F: Fn(HttpRequest, Payload, &S) -> R + 'static,
|
where F: Fn(HttpRequest, Payload, &S) -> R + 'static,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user