Rust 的 RESTful 框架 rustful

码农软件 · 软件分类 · REST/RESTful项目 · 2019-03-11 06:44:22

软件介绍

rustful 是 Rust 编程语言的一个 RESTful 框架,主要目的是创建一个简单、轻量级的 HTTP 服务应用基础。基于无状态结构,根据路径和 HTTP 方法映射到响应处理器。

示例代码:

//Include rustful_macros during syntax phase to be able to use the macros
#![feature(phase)]
#[phase(plugin)]
extern crate rustful_macros;

extern crate rustful;
extern crate http;
use rustful::{Server, Request, Response};
use http::method::Get;

///Our handler function
fn handler(request: Request, response: &mut Response) {
    //Send something nice to the user
    try_send!(response, "Hello, user! It looks like this server works fine." while "sending hello");
}

fn main() {
    let server = Server::new(8080, router!{"/" => Get: handler});

    //Start the server. All code beyond this point is unreachable
    server.run();
}

本文地址:https://codercto.com/soft/d/1084.html

C算法(第二卷:图算法)(第3版)

C算法(第二卷:图算法)(第3版)

塞德威克(Sedgewick Robert) / 周良忠 / 第1版 (2004年1月1日) / 2004-4 / 38.0

《C算法(第2卷)(图算法)(第3版)(中文版)》所讨论的图算法,都是实际中解决图问题的最重要的已知方法。《C算法(第2卷)(图算法)(第3版)(中文版)》的主要宗旨是让越来越多需要了解这些算法的人的能够掌握这些方法及基本原理。书中根据基本原理从基本住处开始循序渐进地讲解,然后再介绍一些经典方法,最后介绍仍在进行研究和发展的现代技术。精心挑选的实例、详尽的图示以及完整的实现代码与正文中的算法和应用......一起来看看 《C算法(第二卷:图算法)(第3版)》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换