pub struct Container {
pub declared_size: u64,
pub first_chunk: u64,
pub head: Option<Head>,
pub chunks: Vec<Chunk>,
pub trailing: usize,
/* private fields */
}Expand description
A parsed .clip container. Holds the original bytes.
Fields§
§declared_size: u64File size the header declares.
first_chunk: u64Offset of the first chunk the header declares (24).
head: Option<Head>The CHNKHead contents, if the file has one.
chunks: Vec<Chunk>Every chunk, in file order.
trailing: usizeBytes after the footer chunk (none in CSP files).
Implementations§
Source§impl Container
impl Container
Sourcepub fn parse(data: Vec<u8>) -> Result<Self>
pub fn parse(data: Vec<u8>) -> Result<Self>
Parses the bytes of a .clip; fails on a truncated or malformed container.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
The bytes as read, by value.
Sourcepub fn sqlite_chunk(&self) -> Option<&Chunk>
pub fn sqlite_chunk(&self) -> Option<&Chunk>
The database chunk.
Sourcepub fn external_chunks(&self) -> impl Iterator<Item = &Chunk>
pub fn external_chunks(&self) -> impl Iterator<Item = &Chunk>
External chunks in file order.
Sourcepub fn external_chunk(&self, id: &str) -> Option<&Chunk>
pub fn external_chunk(&self, id: &str) -> Option<&Chunk>
The external chunk with this id.
Sourcepub fn external(&self, id: &str) -> Option<&[u8]>
pub fn external(&self, id: &str) -> Option<&[u8]>
Payload of an external chunk (after its id). None when the id is not stored: CSP keeps ids of offscreens it will build on opening.
Sourcepub fn external_ids(&self) -> impl Iterator<Item = &str>
pub fn external_ids(&self) -> impl Iterator<Item = &str>
Ids of the external chunks, in file order.
Sourcepub fn findings(&self) -> Vec<String>
pub fn findings(&self) -> Vec<String>
Structural problems that do not stop reading (empty when CSP-like).
Sourcepub fn reassemble(&self) -> Vec<u8> ⓘ
pub fn reassemble(&self) -> Vec<u8> ⓘ
Rebuild the file from its parsed parts (used to prove the parser
misses nothing: the result must equal Container::bytes).