pub struct ContainerBuilder { /* private fields */ }Expand description
Helper that builds .lnmp containers from parsed records or raw payloads.
Implementations§
Source§impl ContainerBuilder
impl ContainerBuilder
Sourcepub fn new(mode: LnmpFileMode) -> Self
pub fn new(mode: LnmpFileMode) -> Self
Starts a builder for the given mode.
Sourcepub fn with_flags(self, flags: u16) -> Self
pub fn with_flags(self, flags: u16) -> Self
Overrides the header flags.
Sourcepub fn with_metadata(
self,
metadata: Vec<u8>,
) -> Result<Self, ContainerEncodeError>
pub fn with_metadata( self, metadata: Vec<u8>, ) -> Result<Self, ContainerEncodeError>
Attaches metadata bytes that are written after the header.
Sourcepub fn with_metadata_bytes(
self,
metadata: &[u8],
) -> Result<Self, ContainerEncodeError>
pub fn with_metadata_bytes( self, metadata: &[u8], ) -> Result<Self, ContainerEncodeError>
Attaches metadata from a borrowed buffer.
Sourcepub fn with_checksum_confirmation(self, confirmed: bool) -> Self
pub fn with_checksum_confirmation(self, confirmed: bool) -> Self
Indicates whether checksum hints are present when checksum flag is set.
Sourcepub const fn header(&self) -> LnmpContainerHeader
pub const fn header(&self) -> LnmpContainerHeader
Returns the current header snapshot.
Sourcepub fn wrap_payload(
self,
payload: &[u8],
) -> Result<Vec<u8>, ContainerEncodeError>
pub fn wrap_payload( self, payload: &[u8], ) -> Result<Vec<u8>, ContainerEncodeError>
Wraps an existing payload slice with the configured header/metadata.
Sourcepub fn encode_record(
self,
record: &LnmpRecord,
) -> Result<Vec<u8>, ContainerEncodeError>
pub fn encode_record( self, record: &LnmpRecord, ) -> Result<Vec<u8>, ContainerEncodeError>
Encodes a record according to the selected mode and wraps it in a container.
Sourcepub fn with_stream_metadata(
self,
meta: StreamMetadata,
) -> Result<Self, ContainerEncodeError>
pub fn with_stream_metadata( self, meta: StreamMetadata, ) -> Result<Self, ContainerEncodeError>
Attaches stream metadata and switches mode to stream.
Sourcepub fn with_delta_metadata(
self,
meta: DeltaMetadata,
) -> Result<Self, ContainerEncodeError>
pub fn with_delta_metadata( self, meta: DeltaMetadata, ) -> Result<Self, ContainerEncodeError>
Attaches delta metadata and switches mode to delta.
Trait Implementations§
Source§impl Clone for ContainerBuilder
impl Clone for ContainerBuilder
Source§fn clone(&self) -> ContainerBuilder
fn clone(&self) -> ContainerBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ContainerBuilder
impl RefUnwindSafe for ContainerBuilder
impl Send for ContainerBuilder
impl Sync for ContainerBuilder
impl Unpin for ContainerBuilder
impl UnwindSafe for ContainerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more