Struct mcap::read::Summary

source ·
pub struct Summary<'a> {
    pub stats: Option<Statistics>,
    pub channels: HashMap<u16, Arc<Channel<'a>>>,
    pub schemas: HashMap<u16, Arc<Schema<'a>>>,
    pub chunk_indexes: Vec<ChunkIndex>,
    pub attachment_indexes: Vec<AttachmentIndex>,
    pub metadata_indexes: Vec<MetadataIndex>,
}
Expand description

Indexes of an MCAP file parsed from its (optional) summary section

Fields§

§stats: Option<Statistics>§channels: HashMap<u16, Arc<Channel<'a>>>

Maps channel IDs to their channel

§schemas: HashMap<u16, Arc<Schema<'a>>>

Maps schema IDs to their schema

§chunk_indexes: Vec<ChunkIndex>§attachment_indexes: Vec<AttachmentIndex>§metadata_indexes: Vec<MetadataIndex>

Implementations§

source§

impl<'a> Summary<'a>

source

pub fn read(mcap: &'a [u8]) -> McapResult<Option<Self>>

Read the summary section of the given mapped MCAP file, if it has one.

source

pub fn stream_chunk( &self, mcap: &'a [u8], index: &ChunkIndex ) -> McapResult<impl Iterator<Item = McapResult<Message<'a>>> + '_>

Stream messages from the chunk with the given index.

To avoid having to read all preceding chunks first, channels and their schemas are pulled from this summary.

source

pub fn read_message_indexes( &self, mcap: &[u8], index: &ChunkIndex ) -> McapResult<HashMap<Arc<Channel<'_>>, Vec<MessageIndexEntry>>>

Read the mesage indexes for the given indexed chunk.

Channels and their schemas are pulled from this summary. The offsets in each MessageIndexEntry is relative to the decompressed contents of the given chunk.

source

pub fn seek_message( &self, mcap: &'a [u8], index: &ChunkIndex, message: &MessageIndexEntry ) -> McapResult<Message<'_>>

Seek to the given message in the given indexed chunk.

If you’re interested in more than a single message from the chunk, filtering Summary::stream_chunk is probably a better bet. Compressed chunks aren’t random access - this decompresses everything in the chunk before message.offset and throws it away.

Trait Implementations§

source§

impl Debug for Summary<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for Summary<'a>

source§

fn default() -> Summary<'a>

Returns the “default value” for a type. Read more
source§

impl<'a> PartialEq for Summary<'a>

source§

fn eq(&self, other: &Summary<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Summary<'a>

source§

impl<'a> StructuralEq for Summary<'a>

source§

impl<'a> StructuralPartialEq for Summary<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Summary<'a>

§

impl<'a> Send for Summary<'a>

§

impl<'a> Sync for Summary<'a>

§

impl<'a> Unpin for Summary<'a>

§

impl<'a> UnwindSafe for Summary<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.