Skip to content

Commit

Permalink
Solve PR comments.
Browse files Browse the repository at this point in the history
* Move meta to meta_struct.
* Add doc to read_map_len.
  • Loading branch information
hoolioh committed Feb 17, 2025
1 parent 6604c56 commit f9acc74
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions trace-utils/src/msgpack_decoder/decode/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ where
Ok(map)
}

/// Reads map length from the buffer
///
/// # Arguments
///
/// * `buf` - A reference to the Bytes containing the encoded map data.
///
/// # Returns
///
/// * `Ok(usize)` - Map length.
/// * `Err(DecodeError)` - An error if the decoding process fails.
///
/// # Errors
///
/// This function will return an error if:
/// - The buffer does not contain a map.
/// - There is an error reading from the buffer.
#[inline]
pub fn read_map_len(buf: &mut &[u8]) -> Result<usize, DecodeError> {
match decode::read_marker(buf)
Expand Down
2 changes: 1 addition & 1 deletion trace-utils/src/msgpack_decoder/decode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pub mod error;
pub mod map;
pub mod meta;
pub mod meta_struct;
pub mod metrics;
pub mod number;
pub mod span_link;
Expand Down
2 changes: 1 addition & 1 deletion trace-utils/src/msgpack_decoder/v04/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::msgpack_decoder::decode::span_link::read_span_links;
use crate::msgpack_decoder::decode::string::{
read_nullable_str_map_to_bytes_strings, read_nullable_string_bytes, read_string_ref,
};
use crate::msgpack_decoder::decode::{meta::read_meta_struct, metrics::read_metrics};
use crate::msgpack_decoder::decode::{meta_struct::read_meta_struct, metrics::read_metrics};
use crate::span::v04::{Span, SpanKey};
use tinybytes::Bytes;

Expand Down

0 comments on commit f9acc74

Please sign in to comment.