|
1 | 1 | <!-- Serde readme rendered on crates.io -->
|
2 | 2 |
|
3 |
| -**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** |
| 3 | +**Serde Core is a collection of core functionalities and abstractions for Serde, a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** |
4 | 4 |
|
5 | 5 | ---
|
6 | 6 |
|
| 7 | +Serde Core exposes core traits and utilities for interacting with Serde's data model. |
| 8 | +It is intended to be consumed by Serde's data formats and other crates that implement the Serde traits by hand. |
| 9 | +If you are looking to use Serde in your library/application to simply serialize and deserialize data, you most likely want to use [Serde](https://crates.io/crates/serde) directly. |
| 10 | +Serde Core does _not_ offer any convenience functions for automatically implementing `Serialize` or `Deserialize` via a `#[derive]` macro. |
| 11 | + |
7 | 12 | You may be looking for:
|
8 | 13 |
|
| 14 | +- [API documentation](https://docs.rs/serde_core) |
9 | 15 | - [An overview of Serde](https://serde.rs/)
|
10 | 16 | - [Data formats supported by Serde](https://serde.rs/#data-formats)
|
11 |
| -- [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) |
12 | 17 | - [Examples](https://serde.rs/examples.html)
|
13 |
| -- [API documentation](https://docs.rs/serde) |
14 |
| -- [Release notes](https://github.com/serde-rs/serde/releases) |
15 |
| - |
16 |
| -## Serde in action |
17 |
| - |
18 |
| -```rust |
19 |
| -use serde::{Deserialize, Serialize}; |
20 |
| - |
21 |
| -#[derive(Serialize, Deserialize, Debug)] |
22 |
| -struct Point { |
23 |
| - x: i32, |
24 |
| - y: i32, |
25 |
| -} |
26 |
| - |
27 |
| -fn main() { |
28 |
| - let point = Point { x: 1, y: 2 }; |
29 |
| - |
30 |
| - // Convert the Point to a JSON string. |
31 |
| - let serialized = serde_json::to_string(&point).unwrap(); |
32 |
| - |
33 |
| - // Prints serialized = {"x":1,"y":2} |
34 |
| - println!("serialized = {}", serialized); |
35 |
| - |
36 |
| - // Convert the JSON string back to a Point. |
37 |
| - let deserialized: Point = serde_json::from_str(&serialized).unwrap(); |
38 |
| - |
39 |
| - // Prints deserialized = Point { x: 1, y: 2 } |
40 |
| - println!("deserialized = {:?}", deserialized); |
41 |
| -} |
42 |
| -``` |
| 18 | +- [Release notes](https://github.com/serde-rs/serde_core/releases) |
43 | 19 |
|
44 | 20 | ## Getting help
|
45 | 21 |
|
|
0 commit comments