Struct rustful::handler::ContentFactory [] [src]

pub struct ContentFactory<T: CreateContent>(pub T);

An adapter for simple content creation handlers.

use rustful::{DefaultRouter, Context, Server, ContentFactory};
use rustful::Method::Get;

type Router<T> = DefaultRouter<ContentFactory<T>>;

let mut router = Router::new();
router.build().path("*").then().on_get(|context: Context| format!("Visiting {}", context.uri_path));

let server = Server {
    handlers: router,
    ..Server::default()
};

Trait Implementations

impl<T: CreateContent, H: Into<ContentFactory<T>>> FromHandler<H> for ContentFactory<T>
[src]

Create a handler from another handler and a BuilderContext.

impl<T: CreateContent> ApplyContext for ContentFactory<T>
[src]

Set properties, based on a given context.

Prepend existing properties, based on a given context.

impl<T: CreateContent> Merge for ContentFactory<T>
[src]

Combine this handler with another, overwriting conflicting properties.

impl<T: CreateContent> HandleRequest for ContentFactory<T>
[src]

Try to handle an incoming request from the client, or return the request environment to the parent handler. Read more

List all of the hyperlinks into this handler, based on the provided base link. It's up to the handler implementation to decide how deep to go. Read more

impl<T: CreateContent> From<T> for ContentFactory<T>
[src]

Performs the conversion.

Auto Trait Implementations

impl<T> Send for ContentFactory<T>

impl<T> Sync for ContentFactory<T>