Skip to main content

encode_kept_fields

Function encode_kept_fields 

Source
pub fn encode_kept_fields(
    document: &Document,
    document_type: DocumentTypeRef<'_>,
) -> Result<Vec<u8>, ProtocolError>
Expand description

Encodes the values a removal record keeps of document, a document of document_type (moderatorAbilities.deleteKeepsFields), the way the document encodes its properties: for each path the type lists, in the list’s order, 0 when the document holds no value there, or 1 followed by the value as an optional property of its type is written (DocumentPropertyType::encode_value_ref_with_size), an object length-prefixed with its members in order, a time or a block height as eight big-endian bytes and a core block height as four. The paths themselves are not written: the type lists them and never changes the list, so a reader knows them from the type. Empty for a type that keeps none.