Collect Resource types in a module

This commit is contained in:
Magnus Hoff 2017-10-13 15:21:23 +02:00
parent 5c161ed13e
commit d1a3814286
8 changed files with 13 additions and 11 deletions

View file

@ -23,18 +23,14 @@ extern crate titlecase;
use std::net::SocketAddr;
mod article_redirect_resource;
mod article_resource;
mod assets;
mod changes_resource;
mod db;
mod mimes;
mod models;
mod new_article_resource;
mod rendering;
mod resources;
mod schema;
mod site;
mod sitemap_resource;
mod state;
mod web;
mod wiki_lookup;

11
src/resources/mod.rs Normal file
View file

@ -0,0 +1,11 @@
mod article_redirect_resource;
mod article_resource;
mod changes_resource;
mod new_article_resource;
mod sitemap_resource;
pub use self::article_redirect_resource::ArticleRedirectResource;
pub use self::article_resource::ArticleResource;
pub use self::changes_resource::ChangesResource;
pub use self::new_article_resource::NewArticleResource;
pub use self::sitemap_resource::SitemapResource;

View file

@ -3,11 +3,8 @@ use std::collections::HashMap;
use futures::{Future, finished, failed};
use percent_encoding::percent_decode;
use article_redirect_resource::ArticleRedirectResource;
use article_resource::ArticleResource;
use resources::*;
use assets::*;
use new_article_resource::NewArticleResource;
use sitemap_resource::SitemapResource;
use state::State;
use web::{Lookup, Resource};
@ -18,8 +15,6 @@ lazy_static! {
static ref LOOKUP_MAP: HashMap<String, ResourceFn> = {
let mut lookup_map = HashMap::new();
use changes_resource::ChangesResource;
lookup_map.insert(
"/_changes".to_string(),
Box::new(|state: &State|