Skip to content
API REFERENCEUsage guides →

cellpack::format::OwnedMeta ​

struct

Module contract · All interfaces

At a glance ​

pub struct OwnedMeta { /* private fields */ }

Immutable metadata bytes and a validated descriptor. Views borrow only this owner; section offsets avoid self-referential pointers and lifetime extension.

Member index ​

4 of 4 members

  • newCopies the metadata out of input (the metadata alone or a whole chunk), keeping only the meta_len bytes the header declares.
  • from_vecValidates bytes and takes ownership of the metadata prefix, dropping anything past meta_len .
  • bytesThe metadata bytes, exactly meta_len long.
  • viewA descriptor borrowing self ; the section ranges stored at construction become slices of the same bytes, so repeated calls are free and never re-parse.

Methods and associated constants ​

new ​

pub fn new(input: &[u8]) -> Result<Self>

Copies the metadata out of input (the metadata alone or a whole chunk), keeping only the meta_len bytes the header declares.

from_vec ​

pub fn from_vec(bytes: Vec<u8>) -> Result<Self>

Validates bytes and takes ownership of the metadata prefix, dropping anything past meta_len.

The section ranges recorded here are byte offsets into those same bytes, computed while the slices returned by parse_meta are still borrowed; truncation cannot invalidate them because every section lies below meta_len.

bytes ​

pub fn bytes(&self) -> &[u8] ⓘ

The metadata bytes, exactly meta_len long.

view ​

pub fn view(&self) -> Meta<'_>

A descriptor borrowing self; the section ranges stored at construction become slices of the same bytes, so repeated calls are free and never re-parse.

The returned view lives as long as the borrow of self, not as long as the owning OwnedMeta.

Implemented traits ​

impl Debug for OwnedMeta

Contract reference ​

See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.

Definition