8 unstable releases (3 breaking)

Uses old Rust 2015

0.3.0 Oct 9, 2016
0.2.1 Jun 16, 2016
0.2.0 May 13, 2016
0.1.3 Apr 5, 2016
0.0.1 Dec 13, 2015

#336 in #framework

Download history 44/week @ 2021-04-11 18/week @ 2021-04-18 20/week @ 2021-04-25 21/week @ 2021-05-02 8/week @ 2021-05-09 17/week @ 2021-05-16 15/week @ 2021-05-23 15/week @ 2021-05-30 23/week @ 2021-06-06 18/week @ 2021-06-13 9/week @ 2021-06-20 15/week @ 2021-06-27 15/week @ 2021-07-04 26/week @ 2021-07-11 31/week @ 2021-07-18 21/week @ 2021-07-25

93 downloads per month

BSD-3-Clause

225KB
2K SLoC

#Pencil

Build Status Crates.io Version Crates.io LICENSE

A microframework for Rust inspired by Flask.

extern crate pencil;

use pencil::{Pencil, Request, Response, PencilResult};

fn hello(_: &mut Request) -> PencilResult {
    Ok(Response::from("Hello World!"))
}

fn main() {
    let mut app = Pencil::new("/web/hello");
    app.get("/", "hello", hello);
    app.run("127.0.0.1:5000");
}

One simple guide: https://fengsp.github.io/blog/2016/3/introducing-pencil/

If you feel anything wrong, feedbacks or pull requests are welcome.


lib.rs:

Pencil is a microframework for Rust inspired by Flask.

Installation

This crate is called pencil and you can depend on it via cargo:

[dependencies]
pencil = "*"

Quickstart

A short introduction to Pencil.

A Minimal Application

A minimal Pencil application looks something like this:

extern crate pencil;

use pencil::Pencil;
use pencil::{Request, PencilResult, Response};
use pencil::method::Get;


fn hello(_: &mut Request) -> PencilResult {
    Ok(Response::from("Hello World!"))
}


fn main() {
    let mut app = Pencil::new("/web/hello");
    app.route("/", &[Get], "hello", hello);
    app.run("127.0.0.1:5000");
}

Dependencies

~12MB
~262K SLoC