mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-18 07:34:26 +00:00
[Rust] Flexbuffers dependency cleanup and fixes (#5998)
* Fix doc comment warnings
Can't use doc comment "///" syntax on macros, that generates the following warning:
warning: unused doc comment
--> src\flexbuffer_type.rs:236:5
|
236 | /// returns true if and only if the flexbuffer type is `VectorFloat4`.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macros
|
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
So switched to just use ordinary "//" comments on these to be warning free
* Upgrade num_enum 0.4.1 -> 0.5.0
* Remove unused and non-working usage of test crates
* Remove usage of abandoned debug_stub_derive crate
Which brought in old pre-v1 syn and quote crates.
This replaces it with just manual Debug trait implementation instead for the 2 cases
This commit is contained in:
@@ -22,9 +22,8 @@ use std::iter::{DoubleEndedIterator, ExactSizeIterator, FusedIterator, Iterator}
|
||||
/// MapReaders may be indexed with strings or usizes. `index` returns a result type,
|
||||
/// which may indicate failure due to a missing key or bad data, `idx` returns an Null Reader in
|
||||
/// cases of error.
|
||||
#[derive(DebugStub, Default, Clone)]
|
||||
#[derive(Default, Clone)]
|
||||
pub struct MapReader<'de> {
|
||||
#[debug_stub = "&[..]"]
|
||||
pub(super) buffer: &'de [u8],
|
||||
pub(super) values_address: usize,
|
||||
pub(super) keys_address: usize,
|
||||
@@ -33,6 +32,20 @@ pub struct MapReader<'de> {
|
||||
pub(super) length: usize,
|
||||
}
|
||||
|
||||
// manual implementation of Debug because buffer slice can't be automatically displayed
|
||||
impl<'de> std::fmt::Debug for MapReader<'de> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
// skips buffer field
|
||||
f.debug_struct("MapReader")
|
||||
.field("values_address", &self.values_address)
|
||||
.field("keys_address", &self.keys_address)
|
||||
.field("values_width", &self.values_width)
|
||||
.field("keys_width", &self.keys_width)
|
||||
.field("length", &self.length)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> MapReader<'de> {
|
||||
/// Returns the number of key/value pairs are in the map.
|
||||
pub fn len(&self) -> usize {
|
||||
|
||||
Reference in New Issue
Block a user