24个版本 (13个重大更新)
使用旧的Rust 2015
0.14.2 | 2017年3月27日 |
---|---|
0.13.0 | 2017年2月3日 |
0.11.3 | 2016年12月24日 |
0.11.1 | 2016年11月19日 |
0.5.0 | 2016年7月28日 |
#23 in #deserializing
4,962 每月下载量
在 288 个crate中使用 (2 直接使用)
44KB
911 行
Serde

Serde是一个框架,用于高效和通用地序列化和反序列化Rust数据结构。
你可能还想要查看
Serde实战
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[derive(Serialize, Deserialize, Debug)]
struct Point {
x: i32,
y: i32,
}
fn main() {
let point = Point { x: 1, y: 2 };
// Convert the Point to a JSON string.
let serialized = serde_json::to_string(&point).unwrap();
// Prints serialized = {"x":1,"y":2}
println!("serialized = {}", serialized);
// Convert the JSON string back to a Point.
let deserialized: Point = serde_json::from_str(&serialized).unwrap();
// Prints deserialized = Point { x: 1, y: 2 }
println!("deserialized = {:?}", deserialized);
}
获取帮助
Serde开发者居住在irc.mozilla.org
的#serde频道。#rust频道也是一个很好的资源,通常响应速度更快,但关于Serde的知识较少。如果您不喜欢IRC或者没有收到满意的回复,我们也可以在GitHub问题上回复。
许可证
Serde根据以下任一许可证授权
- Apache License, Version 2.0, (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT许可证 (LICENSE-MIT 或 http://opensource.org/licenses/MIT)
任选其一。
贡献
除非您明确声明,否则根据Apache-2.0许可证定义的您有意提交给Serde的任何贡献,将按照上述方式双重许可,不附加任何额外条款或条件。
依赖关系
~1.5MB
~42K SLoC