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();"*").then().on_get(|context: Context| format!("Visiting {}", context.uri_path));

let server = Server {
    handlers: router,

Trait Implementations

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

Create a handler from another handler and a BuilderContext.

impl<T: CreateContent> ApplyContext for ContentFactory<T>

Set properties, based on a given context.

Prepend existing properties, based on a given context.

impl<T: CreateContent> Merge for ContentFactory<T>

Combine this handler with another, overwriting conflicting properties.

impl<T: CreateContent> HandleRequest for ContentFactory<T>

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>

Performs the conversion.

Auto Trait Implementations

impl<T> Send for ContentFactory<T>

impl<T> Sync for ContentFactory<T>