pub fn merge_within(
buffer: &mut [u8],
second_start: usize,
) -> Result<ZbiContainer<&mut [u8]>, ZbiError>Expand description
Merges two ZBI containers stored on the same buffer.
A typical use scenario is when the caller wants to append ZBI items that need to borrow the existing container in order to be created, but wants to reuse the unused buffer for memory optimization. The caller can split out the unused buffer, borrow the existing container, creates a new container in the unused buffer, and then use this API to merge them together.
§Args:
buffer: The buffer that contains the two ZBI containers. The first container must start from the beginning.second_start: The offset to the second container in the buffer. The offset must be aligned toZBI_ALIGNMENT_USIZE.
§Returns
- On success returns an instance of
ZbiContainerrepresenting the merged container.