Skip to main content

IntoDoc

Derive Macro IntoDoc 

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

Derive an IntoDoc impl that constructs a zvec::Doc from &self.

§Field attributes

Each field accepts at most one #[zvec(...)] attribute. Recognised keys:

keyeffect
pkUse this field as the document’s primary key (must be a String).
rename = "other"Use "other" as the field name in zvec instead of the Rust ident.
skipDon’t emit this field at all.
binaryTreat Vec<u8> as DataType::Binary.
vector_fp32Treat Vec<f32> as DataType::VectorFp32.
vector_fp64Treat Vec<f64> as DataType::VectorFp64.
vector_int8Treat Vec<i8> as DataType::VectorInt8.
vector_int16Treat Vec<i16> as DataType::VectorInt16.

§Supported field types (without explicit type hint)

String, bool, i32, i64, u32, u64, f32, f64. Each of these may be wrapped in Option<T>None emits Doc::set_field_null(name).

Vec<_>-typed fields require an explicit type hint (see table above), because the same Rust type can map to several different zvec DataTypes.