1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-30 16:40:21 +02:00

rename ResourceHandler to Resource

This commit is contained in:
Nikolay Kim
2018-07-12 15:30:01 +06:00
parent db005af1af
commit b8b90d9ec9
10 changed files with 137 additions and 132 deletions

View File

@@ -36,16 +36,16 @@ pub(crate) struct RouteId(usize);
/// "/", |r| r.method(http::Method::GET).f(|r| HttpResponse::Ok()))
/// .finish();
/// }
pub struct ResourceHandler<S = ()> {
pub struct Resource<S = ()> {
name: String,
state: PhantomData<S>,
routes: SmallVec<[Route<S>; 3]>,
middlewares: Rc<Vec<Box<Middleware<S>>>>,
}
impl<S> Default for ResourceHandler<S> {
impl<S> Default for Resource<S> {
fn default() -> Self {
ResourceHandler {
Resource {
name: String::new(),
state: PhantomData,
routes: SmallVec::new(),
@@ -54,9 +54,9 @@ impl<S> Default for ResourceHandler<S> {
}
}
impl<S> ResourceHandler<S> {
impl<S> Resource<S> {
pub(crate) fn default_not_found() -> Self {
ResourceHandler {
Resource {
name: String::new(),
state: PhantomData,
routes: SmallVec::new(),
@@ -74,7 +74,7 @@ impl<S> ResourceHandler<S> {
}
}
impl<S: 'static> ResourceHandler<S> {
impl<S: 'static> Resource<S> {
/// Register a new route and return mutable reference to *Route* object.
/// *Route* is used for route configuration, i.e. adding predicates,
/// setting up handler.