pub struct Writer<'a, W: Write + Seek> { /* private fields */ }
Expand description

Writes an MCAP file to the given writer.

Users should call finish() to flush the stream and check for errors when done; otherwise the result will be unwrapped on drop.


Adds a channel (and its provided schema, if any), returning its ID.

Useful with subequent calls to write_to_known_channel()

Write the given message (and its provided channel, if needed).

Write a message to an added channel, given its ID.

This skips hash lookups of the channel and schema if you already added them.

Finishes the current chunk, if we have one, and flushes the underlying writer.

We finish the chunk to guarantee that the file can be streamed by future readers at least up to this point. (The alternative is to just flush the writer mid-chunk. But if we did that, and then writing was suddenly interrupted afterwards, readers would have to try to recover a half-written chunk, probably with an unfinished compresion stream.)

Note that lossless compression schemes like LZ4 and Zstd improve as they go, so larger chunks will tend to have better compression. (Of course, this depends heavily on the entropy of what’s being compressed! A stream of zeroes will compress great at any chunk size, and a stream of random data will compress terribly at any chunk size.)

Finishes any current chunk and writes out the rest of the file.

Subsequent calls to other methods will panic.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.