pub struct AbiBuffer<T: 'static> { /* private fields */ }
Expand description
A helper structure used with a stream to handle the canonical ABI representation of lists and track partial writes.
This structure is returned whenever a write to a stream completes. This
keeps track of the original buffer used to perform a write (Vec<T>
) and
additionally tracks any partial writes. Writes can then be resumed with
this buffer again or the partial write can be converted back to Vec<T>
to
get access to the remaining values.
This value is created through the StreamWrite
future’s return value.
Implementations§
Source§impl<T: 'static> AbiBuffer<T>
impl<T: 'static> AbiBuffer<T>
Sourcepub fn into_vec(self) -> Vec<T>
pub fn into_vec(self) -> Vec<T>
Converts this AbiBuffer<T>
back into a Vec<T>
This commit consumes this buffer and yields back unwritten values as a
Vec<T>
. The remaining items in Vec<T>
have not yet been written and
all written items have been removed from the front of the list.
Note that the backing storage of the returned Vec<T>
has not changed
from whe this buffer was created.
Also note that this can be an expensive operation if a partial write occurred as this will involve shifting items from the end of the vector to the start of the vector.