Function blobby::encode_blobs[][src]

pub fn encode_blobs<'a, I, T: 'a>(blobs: &'a I) -> (Vec<u8>, usize) where
    &'a I: IntoIterator<Item = &'a T>,
    T: AsRef<[u8]>, 
Expand description

Encode the given collection of binary blobs in .blb format into writer. Returns the encoded data together with a count of the number of blobs included in the index.

The encoded file format is:

  • count of index entries=N
  • N x index entries, each encoded as:
    • size L of index entry (VLQ)
    • index blob contents (L bytes)
  • repeating encoded blobs, each encoded as:
    • VLQ value that is either:
      • (J << 1) & 0x01: indicates this blob is index entry J
      • (L << 1) & 0x00: indicates an explicit blob of len L
    • (in the latter case) explicit blob contents (L bytes)