Skip to content

Commit ccb6827

Browse files
RUST-447 Standardize API with other serde libraries (#179)
1 parent 94eba4e commit ccb6827

File tree

19 files changed

+450
-453
lines changed

19 files changed

+450
-453
lines changed

examples/decode.rs renamed to examples/deserialize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bson::Document;
55
fn main() {
66
let mut f = File::open("examples/test.bson").unwrap();
77

8-
while let Ok(decoded) = Document::decode(&mut f) {
9-
println!("{:?}", decoded);
8+
while let Ok(deserialized) = Document::from_reader(&mut f) {
9+
println!("{:?}", deserialized);
1010
}
1111
}

examples/encode.rs renamed to examples/serialize.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ fn main() {
1616
doc.insert("array".to_string(), Bson::Array(arr));
1717

1818
let mut buf = Vec::new();
19-
doc.encode(&mut buf).unwrap();
19+
doc.to_writer(&mut buf).unwrap();
2020

21-
println!("Encoded: {:?}", buf);
21+
println!("Serialized: {:?}", buf);
2222

23-
let doc = Document::decode(&mut Cursor::new(&buf[..])).unwrap();
24-
println!("Decoded: {:?}", doc);
23+
let doc = Document::from_reader(&mut Cursor::new(&buf[..])).unwrap();
24+
println!("Deserialized: {:?}", doc);
2525
}

fuzz/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ name = "fuzz_target_1"
2222
path = "fuzz_targets/fuzz_target_1.rs"
2323

2424
[[bin]]
25-
name = "decode"
26-
path = "fuzz_targets/decode.rs"
25+
name = "deserialize"
26+
path = "fuzz_targets/deserialize.rs"

fuzz/fuzz_targets/decode.rs renamed to fuzz/fuzz_targets/deserialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ use bson::Document;
66
use std::io::Cursor;
77

88
fuzz_target!(|buf: &[u8]| {
9-
let _ = Document::decode(&mut Cursor::new(&buf[..]));
9+
let _ = Document::from_reader(&mut Cursor::new(&buf[..]));
1010
});

0 commit comments

Comments
 (0)