chilli/
lib.rs

1//! Pencil is a microframework for Rust inspired by [Flask](http://flask.pocoo.org/).
2//!
3//! # Installation
4//!
5//! This crate is called `chilli` and you can depend on it via cargo:
6//!
7//! ```ini
8//! [dependencies]
9//! chilli = "*"
10//! ```
11//!
12//! # Quickstart
13//!
14//! A short introduction to chilli.
15//!
16//! ## A Minimal Application
17//!
18//! A minimal chilli application looks something like this:
19//!
20//! ```rust,no_run
21//! extern crate chilli;
22//!
23//! use chilli::Pencil;
24//! use chilli::{Request, PencilResult, Response};
25//! use chilli::method::Get;
26//!
27//!
28//! fn hello(_: &mut Request) -> PencilResult {
29//!     Ok(Response::from("Hello World!"))
30//! }
31//!
32//!
33//! fn main() {
34//!     let mut app = Pencil::new("/web/hello");
35//!     app.route("/", &[Get], "hello", hello);
36//!     app.run("127.0.0.1:5000");
37//! }
38//! ```
39
40#![allow(unused_attributes)]
41#![crate_name = "chilli"]
42#![crate_type = "lib"]
43#![doc(html_logo_url = "https://raw.githubusercontent.com/fengsp/pencil/master/logo/pencil.png",
44       html_favicon_url = "https://raw.githubusercontent.com/fengsp/pencil/master/logo/favicon.ico",
45       html_root_url = "http://fengsp.github.io/pencil/")]
46
47#![deny(non_camel_case_types)]
48
49#[macro_use]
50extern crate log;
51extern crate hyper;
52extern crate serde;
53extern crate serde_json;
54extern crate regex;
55extern crate url;
56extern crate formdata;
57extern crate handlebars;
58extern crate typemap;
59extern crate mime;
60extern crate mime_guess;
61extern crate lazycell;
62extern crate time;
63
64/* public api */
65pub use app::Pencil;
66pub use types::{
67    PencilError,
68        PenHTTPError,
69        PenUserError,
70    UserError,
71    PencilResult,
72    ViewArgs,
73    ViewFunc,
74    UserErrorHandler,
75    HTTPErrorHandler,
76    BeforeRequestFunc,
77    AfterRequestFunc,
78    TeardownRequestFunc,
79};
80pub use wrappers::{
81    Request,
82    Response,
83};
84pub use http_errors::{
85    HTTPError
86};
87pub use json::jsonify;
88pub use config::{
89    Config,
90};
91pub use helpers::{
92    PathBound,
93    safe_join,
94    abort,
95    redirect,
96    escape,
97    send_file,
98    send_from_directory,
99};
100pub use module::Module;
101pub use handlebars::Handlebars;
102
103pub use hyper::header::{Cookie, SetCookie, Headers, ContentLength, ContentType};
104
105
106#[macro_use]
107mod utils;
108pub mod http_errors;
109pub mod datastructures;
110pub mod wrappers;
111pub mod routing;
112pub mod json;
113pub mod config;
114pub mod helpers;
115pub mod method;
116mod testing;
117mod app;
118mod types;
119mod logging;
120mod serving;
121mod httputils;
122mod templating;
123mod formparser;
124mod module;