- 授权协议: BSD
- 开发语言: Rust
- 操作系统: 跨平台
- 软件首页: https://github.com/fengsp/pencil
- 软件文档: http://fengsp.github.io/pencil/
软件介绍
Pencil Framework 是一个 Rust 的微框架,其灵感来自于 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"); }
路由:
fn user(r: &mut Request) -> PencilResult { let user_id = r.view_args.get("user_id").unwrap(); Ok(format!("user {}", user_id).into()) } fn main() { // app here app.get("/user/<int:user_id>", "user", user); }
JSON 处理:
use std::collections::BTreeMap; use pencil::jsonify; fn app_info(_: &mut Request) -> PencilResult { let mut d = BTreeMap::new(); d.insert("name", "hello"); d.insert("version", "0.1.0"); return jsonify(&d); } fn main() { // app here app.get("/info", "app_info", app_info); }
错误处理:
use pencil::HTTPError; fn page_not_found(_: HTTPError) -> PencilResult { let mut response = Response::from("Customized 404 :)"); response.status_code = 404; Ok(response) } fn main() { // app here app.httperrorhandler(404, page_not_found); }
嵌入式系统软件设计中的常用算法
周航慈 / 2010-1 / 24.00元
《嵌入式系统软件设计中的常用算法》根据嵌入式系统软件设计需要的常用算法知识编写而成。基本内容有:线性方程组求解、代数插值和曲线拟合、数值积分、能谱处理、数字滤波、数理统计、自动控制、数据排序、数据压缩和检错纠错等常用算法。从嵌入式系统的实际应用出发,用通俗易懂的语言代替枯燥难懂的数学推导,使读者能在比较轻松的条件下学到最基本的常用算法,并为继续学习其他算法打下基础。 《嵌入式系统软件设计中的......一起来看看 《嵌入式系统软件设计中的常用算法》 这本书的介绍吧!