ITupleSpanPackable
Namespace: SnowBank.Data.Tuples.Binary · interface
Implements: ITuplePackable
Represents an object that can serialize itself using the Tuple Binary Encoding format
Methods
TryGetSizeHint
bool TryGetSizeHint(bool embedded, out int sizeHint)
Attempts to quickly estimate the minimum buffer capacity required to pack this tuple
embedded—trueif this is an embedded tuple,falseif this is the top-levelsizeHint— Receives the estimated size, or0
Returns: true if the capacity could be quickly estimated, or false if it would require almost as much work as encoding the tuple.
The result MUST include the start/stop bytes for embedded tuples (which will be accounted by the parent)
TryPackTo
bool TryPackTo(ref TupleSpanWriter writer)
Appends the packed bytes of this instance to the end of a buffer, if it is large enough
writer— Buffer that will receive the packed bytes of this instance
true if the operation was successful, or false if it was too small