Struct light_pencil::Pencil
[−]
[src]
pub struct Pencil { pub root_path: String, pub name: String, pub static_folder: String, pub static_url_path: String, pub template_folder: String, pub extensions: ShareMap, pub url_map: Map, // some fields omitted }
Fields
root_path: String
name: String
static_folder: String
static_url_path: String
template_folder: String
extensions: ShareMap
url_map: Map
Methods
impl Pencil
[src]
fn new(root_path: &str) -> Pencil
[src]
fn is_debug(&self) -> bool
[src]
fn is_testing(&self) -> bool
[src]
fn route<M: Into<Matcher>, N: AsRef<[Method]>>(
&mut self,
rule: M,
methods: N,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
methods: N,
endpoint: &str,
view_func: ViewFunc
)
fn get<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
fn post<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
fn delete<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
fn patch<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
fn put<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
fn add_url_rule(
&mut self,
matcher: Matcher,
methods: &[Method],
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
matcher: Matcher,
methods: &[Method],
endpoint: &str,
view_func: ViewFunc
)
fn enable_static_file_handling(&mut self)
[src]
fn before_request<F: Fn(&mut Request) -> Option<PencilResult> + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
fn after_request<F: Fn(&Request, &mut Response) + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
fn teardown_request<F: Fn(Option<&PencilError>) + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
fn register_http_error_handler<F: Fn(HTTPError) -> PencilResult + Send + Sync + 'static>(
&mut self,
status_code: u16,
f: F
)
[src]
&mut self,
status_code: u16,
f: F
)
fn register_user_error_handler<F: Fn(UserError) -> PencilResult + Send + Sync + 'static>(
&mut self,
error_desc: &str,
f: F
)
[src]
&mut self,
error_desc: &str,
f: F
)
fn httperrorhandler<F: Fn(HTTPError) -> PencilResult + Send + Sync + 'static>(
&mut self,
status_code: u16,
f: F
)
[src]
&mut self,
status_code: u16,
f: F
)
fn usererrorhandler<F: Fn(UserError) -> PencilResult + Send + Sync + 'static>(
&mut self,
error_desc: &str,
f: F
)
[src]
&mut self,
error_desc: &str,
f: F
)
fn handle_request(&self, request: &mut Request) -> Response
[src]
fn run<A: ToSocketAddrs>(self, addr: A)
[src]
fn run_threads<A: ToSocketAddrs>(self, addr: A, threads: usize)
[src]
Trait Implementations
impl Handler for Pencil
[src]
fn handle(&self, req: HTTPRequest, res: HTTPResponse)
[src]
Receives a Request
/Response
pair, and should perform some action on them. Read more
fn check_continue(&self, (&Method, &RequestUri, &Headers)) -> StatusCode
[src]
Called when a Request includes a Expect: 100-continue
header. Read more
fn on_connection_start(&self)
[src]
This is run after a connection is received, on a per-connection basis (not a per-request basis, as a connection with keep-alive may handle multiple requests) Read more
fn on_connection_end(&self)
[src]
This is run before a connection is closed, on a per-connection basis (not a per-request basis, as a connection with keep-alive may handle multiple requests) Read more
impl PathBound for Pencil
[src]
fn open_resource(&self, resource: &str) -> File
[src]
impl Display for Pencil
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more