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]
impl<T: CreateContent, H: Into<ContentFactory<T>>> FromHandler<H> for ContentFactory<T>
fn from_handler(_context: BuilderContext, handler: H) -> ContentFactory<T>
[src]
fn from_handler(_context: BuilderContext, handler: H) -> ContentFactory<T>
Create a handler from another handler and a BuilderContext
.
impl<T: CreateContent> ApplyContext for ContentFactory<T>
[src]
impl<T: CreateContent> ApplyContext for ContentFactory<T>
fn apply_context(&mut self, _context: BuilderContext)
[src]
fn apply_context(&mut self, _context: BuilderContext)
Set properties, based on a given context.
fn prepend_context(&mut self, _context: BuilderContext)
[src]
fn prepend_context(&mut self, _context: BuilderContext)
Prepend existing properties, based on a given context.
impl<T: CreateContent> Merge for ContentFactory<T>
[src]
impl<T: CreateContent> Merge for ContentFactory<T>
fn merge(&mut self, other: ContentFactory<T>)
[src]
fn merge(&mut self, other: ContentFactory<T>)
Combine this handler with another, overwriting conflicting properties.
impl<T: CreateContent> HandleRequest for ContentFactory<T>
[src]
impl<T: CreateContent> HandleRequest for ContentFactory<T>
fn handle_request<'a, 'b, 'l, 'g>(
&self,
environment: Environment<'a, 'b, 'l, 'g>
) -> Result<(), Environment<'a, 'b, 'l, 'g>>
[src]
fn handle_request<'a, 'b, 'l, 'g>(
&self,
environment: Environment<'a, 'b, 'l, 'g>
) -> Result<(), Environment<'a, 'b, 'l, 'g>>
Try to handle an incoming request from the client, or return the request environment to the parent handler. Read more
fn hyperlinks<'a>(&'a self, base_link: Link<'a>) -> Vec<Link<'a>>
[src]
fn hyperlinks<'a>(&'a self, base_link: Link<'a>) -> Vec<Link<'a>>
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]
impl<T: CreateContent> From<T> for ContentFactory<T>
fn from(factory: T) -> ContentFactory<T>
[src]
fn from(factory: T) -> ContentFactory<T>
Performs the conversion.
Auto Trait Implementations
impl<T> Send for ContentFactory<T>
impl<T> Send for ContentFactory<T>
impl<T> Sync for ContentFactory<T>
impl<T> Sync for ContentFactory<T>