File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " bson"
3- version = " 0.4.0 "
3+ version = " 0.4.1 "
44authors = [
55 " Y. T. Chung <[email protected] >" ,
66@@ -9,6 +9,7 @@ description = "Encoding and decoding support for BSON in Rust"
99license = " MIT"
1010readme = " README.md"
1111homepage = " https://github.com/zonyitoo/bson-rs"
12+ documentation = " https://docs.rs/crate/bson"
1213
1314[lib ]
1415name = " bson"
@@ -23,4 +24,4 @@ rustc-serialize = "0.3"
2324serde = " 0.9"
2425time = " 0.1"
2526linked-hash-map = " 0.3"
26- hostname = " ^0.1"
27+ hostname = " ^0.1"
Original file line number Diff line number Diff line change @@ -20,12 +20,14 @@ bson = "0.4"
2020```
2121## Usage
2222Link the library in _ main.rs_ :
23+
2324``` rust
2425#[macro_use(bson, doc)]
2526extern crate bson;
2627```
2728
2829Prepare your struct for Serde serialization:
30+
2931``` rust
3032#[derive(Serialize , Deserialize , Debug )]
3133pub struct Person {
@@ -37,6 +39,7 @@ pub struct Person {
3739```
3840
3941Serialize the struct:
42+
4043``` rust
4144use bson;
4245
@@ -56,6 +59,7 @@ if let bson::Bson::Document(document) = serialized_person {
5659```
5760
5861Deserialize the struct:
62+
5963``` rust
6064// Read the document from a MongoDB collection
6165let person_document = mongoCollection. find_one (Some (doc! { " _id" => " 12345" }), None )?
You can’t perform that action at this time.
0 commit comments