[−][src]Crate bson
BSON is a binary format in which zero or more key/value pairs are stored as a single entity. We call this entity a document.
This library supports version 1.0 of the BSON standard.
Basic usage
extern crate bson; use bson::{decode_document, encode_document, Bson, Document}; use std::io::Cursor; fn main() { let mut doc = Document::new(); doc.insert("foo".to_owned(), Bson::String("bar".to_owned())); let mut buf = Vec::new(); encode_document(&mut buf, &doc).unwrap(); let doc = decode_document(&mut Cursor::new(&buf[..])).unwrap(); }
Re-exports
pub use self::ordered::ValueAccessError; |
pub use self::ordered::ValueAccessResult; |
Modules
compat | Backward compatibility |
macros | |
oid | ObjectId |
ordered | A BSON document represented as an associative HashMap with insertion ordering. |
spec | Constants derived from the BSON Specification Version 1.0. |
Macros
bson | Construct a bson::BSON value from a literal. |
doc | Construct a bson::Document value. |
Structs
Decoder | Serde Decoder |
Encoder | Serde Encoder |
TimeStamp |
|
UtcDateTime |
|
Enums
Bson | Possible BSON value types. |
DecoderError | Possible errors that can arise during decoding. |
EncoderError | Possible errors that can arise during encoding. |
Functions
decode_document | Attempt to decode a |
decode_document_utf8_lossy | Attempt to decode a |
encode_document | Attempt to encode a |
from_bson | Decode a BSON |
to_bson | Encode a |
Type Definitions
Array | Alias for |
DecoderResult | Alias for |
Document | Alias for |
EncoderResult | Alias for |