use iron::typemap::Key;
use iron::{IronResult, Request};
use std::any::Any;
pub trait ParserMiddleware: Key + Sync + Send + Any {
fn parse(&self, req: &mut Request) -> IronResult<Self::Value>;
}
pub trait ParsableId: Sized {
fn parse(from: &str) -> IronResult<Self>;
}
pub trait Id: ParsableId + Into<String> + Clone + Key<Value=Self> {}
pub trait Resource: Any{
type RId: Id + Any;
fn id_ref(&self) -> Option<&Self::RId>;
}
pub trait OptionParser: ParserMiddleware {}
pub trait BodyParser<T: Resource+Any>: Key<Value=T> + ParserMiddleware {}