diff options
-rw-r--r-- | rust/flexbuffers/src/reader/map.rs | 2 | ||||
-rw-r--r-- | rust/flexbuffers/src/reader/mod.rs | 2 | ||||
-rw-r--r-- | tests/rust_usage_test/bin/flexbuffers_alloc_check.rs | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/rust/flexbuffers/src/reader/map.rs b/rust/flexbuffers/src/reader/map.rs index b0accacc..7d6ada8a 100644 --- a/rust/flexbuffers/src/reader/map.rs +++ b/rust/flexbuffers/src/reader/map.rs @@ -71,8 +71,6 @@ impl<B: Buffer> std::fmt::Debug for MapReader<B> { impl<B: Buffer> MapReader<B> { /// Returns the number of key/value pairs are in the map. pub fn len(&self) -> usize { - let thing = self.clone(); - println!("{:?}", &thing); self.length } diff --git a/rust/flexbuffers/src/reader/mod.rs b/rust/flexbuffers/src/reader/mod.rs index cac46341..311f91d3 100644 --- a/rust/flexbuffers/src/reader/mod.rs +++ b/rust/flexbuffers/src/reader/mod.rs @@ -306,7 +306,7 @@ impl<B: Buffer> Reader<B> { #[cfg(target_endian = "little")] #[deprecated( since = "0.3.0", - note = "This function is unsafe - if this functionality is needed it can be added separately via the `buffer` function." + note = "This function is unsafe - if this functionality is needed use `Reader::buffer::align_to`" )] pub fn get_slice<T: ReadLE>(&self) -> Result<&[T], Error> { if self.flexbuffer_type().typed_vector_type() != T::VECTOR_TYPE.typed_vector_type() { diff --git a/tests/rust_usage_test/bin/flexbuffers_alloc_check.rs b/tests/rust_usage_test/bin/flexbuffers_alloc_check.rs index 847d7c6a..a921af7f 100644 --- a/tests/rust_usage_test/bin/flexbuffers_alloc_check.rs +++ b/tests/rust_usage_test/bin/flexbuffers_alloc_check.rs @@ -70,6 +70,10 @@ fn make_monster(mut monster: MapBuilder) { fn validate_monster(flexbuffer: &[u8]) { let r = Reader::get_root(flexbuffer).unwrap().as_map(); + assert!(!r.is_empty()); + assert!(r.index_key("not_a_field").is_none()); + + assert_eq!(r.len(), 7); assert_eq!(r.idx("type").as_str(), "great orc"); assert_eq!(r.idx("age").as_u8(), 100); assert_eq!(r.idx("name").as_str(), "Mr. Orc"); |