pub fn as_document(&self) -> Result<bson::Document> {
        assert!(!self.inner.is_null());

        // This pointer should not be modified or freed
        // See: http://mongoc.org/libbson/current/bson_get_data.html
        let data_ptr = unsafe { bindings::bson_get_data(self.inner) };
        assert!(!data_ptr.is_null());

        let data_len = unsafe {
            let bson = *self.inner;
            bson.len
        } as usize;

        let mut slice = unsafe { slice::from_raw_parts(data_ptr, data_len) };

        let document = try!(Document::from_reader(&mut slice));
        Ok(document)
    }
/// Decode a bson from the C side to a document
Decode a bson from the C side to a document
Decode a bson from the C side to a document
pub fn as_document(&self) -> Result<bson::Document> {
        assert!(!self.inner.is_null());
        // This pointer should not be modified or freed
        // See: http://mongoc.org/libbson/current/bson_get_data.html
        let data_ptr = unsafe { bindings::bson_get_data(self.inner) };
        assert!(!data_ptr.is_null());
        let data_len = unsafe {
            let bson = *self.inner;
            bson.len
        } as usize;
        let mut slice = unsafe { slice::from_raw_parts(data_ptr, data_len) };
        let document = try!(Document::from_reader(&mut slice));
        Ok(document)
    }
pub fn as_document ( & self ) -> Result < bson :: Document > { assert ! ( self inner is_null ( ) ) ; // This pointer should not be modified or freed // See: http://mongoc.org/libbson/current/bson_get_data.html let data_ptr = unsafe { bindings :: bson_get_data ( self . inner ) } ; assert ! ( data_ptr is_null ( ) ) ; let data_len = unsafe { let bson = * self . inner ; bson . len } as usize ; let mut slice = unsafe { slice :: from_raw_parts ( data_ptr , data_len ) } ; let document = try ! ( Document from_reader ( mut slice ) ) ; Ok ( document ) }
Decode a bson from the C side to a document
Decode a bson from the C side to a document
&self
&self