1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-23 22:15:13 +02:00

Propagate default resources to underlying scopes

This commit is contained in:
Josh Leeb-du Toit
2018-06-21 18:17:27 +10:00
parent f815c1c096
commit c5e8c1b710
3 changed files with 35 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
use std::cell::RefCell;
use std::marker::PhantomData;
use std::ops::Deref;
use std::rc::Rc;
use futures::future::{err, ok, Future};
use futures::{Async, Poll};
@@ -8,6 +10,7 @@ use error::Error;
use http::StatusCode;
use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use resource::ResourceHandler;
/// Trait defines object that could be registered as route handler
#[allow(unused_variables)]
@@ -403,6 +406,14 @@ where
// /// Trait defines object that could be registered as resource route
pub(crate) trait RouteHandler<S>: 'static {
fn handle(&mut self, req: HttpRequest<S>) -> AsyncResult<HttpResponse>;
fn has_default_resource(&self) -> bool {
false
}
fn default_resource(&mut self, default: Rc<RefCell<ResourceHandler<S>>>) {
unimplemented!()
}
}
/// Route handler wrapper for Handler