pub struct Type1Blob {
pub header: DeliveryBlobHeader,
pub payload_length: usize,
pub is_compressed: bool,
}
Expand description
Header + metadata fields of a Type 1 blob.
WARNING: Outside of storage-owned components, this should only be used for informational or debugging purposes. The contents of this struct should be considered internal implementation details and are subject to change at any time.
Fields§
§header: DeliveryBlobHeader
§payload_length: usize
§is_compressed: bool
Implementations§
Source§impl Type1Blob
impl Type1Blob
pub const HEADER: DeliveryBlobHeader = _
Sourcepub fn generate(data: &[u8], mode: CompressionMode) -> Vec<u8> ⓘ
pub fn generate(data: &[u8], mode: CompressionMode) -> Vec<u8> ⓘ
Generate a Type 1 delivery blob for data
using the specified mode
.
WARNING: This function will panic on error.
Sourcepub fn generate_to(
data: &[u8],
mode: CompressionMode,
writer: impl Write,
) -> Result<(), Error>
pub fn generate_to( data: &[u8], mode: CompressionMode, writer: impl Write, ) -> Result<(), Error>
Generate a Type 1 delivery blob for data
using the specified mode
. Writes delivery blob
directly into writer
.
WARNING: This function will panic on compression errors.
Sourcepub fn parse(
data: &[u8],
) -> Result<Option<(Type1Blob, &[u8])>, DeliveryBlobError>
pub fn parse( data: &[u8], ) -> Result<Option<(Type1Blob, &[u8])>, DeliveryBlobError>
Attempt to parse data
as a Type 1 delivery blob. On success, returns validated blob info,
and the remainder of data
representing the blob payload.
WARNING: This function does not verify that the payload is complete. Only the full
header and metadata portion of a delivery blob are required to be present in data
.
Sourcepub fn decompressed_size(delivery_blob: &[u8]) -> Result<u64, DecompressError>
pub fn decompressed_size(delivery_blob: &[u8]) -> Result<u64, DecompressError>
Return the decompressed size of the blob without decompressing it.
Sourcepub fn decompress(delivery_blob: &[u8]) -> Result<Vec<u8>, DecompressError>
pub fn decompress(delivery_blob: &[u8]) -> Result<Vec<u8>, DecompressError>
Decompress a Type 1 delivery blob in delivery_blob
.
Sourcepub fn decompress_to(
delivery_blob: &[u8],
writer: impl Write,
) -> Result<(), DecompressError>
pub fn decompress_to( delivery_blob: &[u8], writer: impl Write, ) -> Result<(), DecompressError>
Decompress a Type 1 delivery blob in delivery_blob
to writer
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Type1Blob
impl RefUnwindSafe for Type1Blob
impl Send for Type1Blob
impl Sync for Type1Blob
impl Unpin for Type1Blob
impl UnwindSafe for Type1Blob
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)