Struct pen::Pen
[−]
[src]
pub struct Pen { 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 Pen
[src]
pub fn new(root_path: &str) -> Pen
[src]
pub fn is_debug(&self) -> bool
[src]
pub fn is_testing(&self) -> bool
[src]
pub 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
)
pub fn get<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
pub fn post<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
pub fn delete<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
pub fn patch<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
pub fn put<M: Into<Matcher>>(
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
[src]
&mut self,
rule: M,
endpoint: &str,
view_func: ViewFunc
)
pub 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
)
pub fn enable_static_file_handling(&mut self)
[src]
pub fn before_request<F: Fn(&mut Request) -> Option<PenResult> + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
pub fn after_request<F: Fn(&Request, &mut Response) + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
pub fn teardown_request<F: Fn(Option<&PenError>) + Send + Sync + 'static>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
pub fn register_http_error_handler<F: Fn(HTTPError) -> PenResult + Send + Sync + 'static>(
&mut self,
status_code: u16,
f: F
)
[src]
&mut self,
status_code: u16,
f: F
)
pub fn register_user_error_handler<F: Fn(UserError) -> PenResult + Send + Sync + 'static>(
&mut self,
error_desc: &str,
f: F
)
[src]
&mut self,
error_desc: &str,
f: F
)
pub fn httperrorhandler<F: Fn(HTTPError) -> PenResult + Send + Sync + 'static>(
&mut self,
status_code: u16,
f: F
)
[src]
&mut self,
status_code: u16,
f: F
)
pub fn usererrorhandler<F: Fn(UserError) -> PenResult + Send + Sync + 'static>(
&mut self,
error_desc: &str,
f: F
)
[src]
&mut self,
error_desc: &str,
f: F
)
pub fn handle_request(&self, request: &mut Request) -> Response
[src]
pub fn run<A: ToSocketAddrs>(self, addr: A)
[src]
pub fn run_threads<A: ToSocketAddrs>(self, addr: A, threads: usize)
[src]
Trait Implementations
impl Handler for Pen
[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 Pen
[src]
ⓘImportant traits for &'a Filefn open_resource(&self, resource: &str) -> File
[src]
ⓘImportant traits for &'a File
impl Display for Pen
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more