Skip to main content

FromDoc

Derive Macro FromDoc 

Source
#[derive(FromDoc)]
{
    // Attributes available to this derive:
    #[zvec]
}
Expand description

Derive a FromDoc impl that constructs Self from a zvec::DocRef<'_>.

Mirrors IntoDoc’s attribute set:

keyeffect
pkField takes the document’s primary key via DocRef::pk_copy.
rename = "other"Read the zvec-side field name "other" instead of the Rust ident.
skipDon’t read from the doc; initialise via Default::default().
binaryRead the field as Vec<u8> / binary.
vector_fp32Read as Vec<f32> via get_vector_fp32.
vector_fp64Read as Vec<f64> via get_vector_fp64.
vector_int8Read as Vec<i8> via get_vector_int8.
vector_int16Read as Vec<i16> via get_vector_int16.

Option<T> fields tolerate missing documents (returns None); non-Option fields error with ErrorCode::InvalidArgument when the doc is missing them.