pub trait Slot {
type Of: ?Sized;
const SLOT: &'static SlotName;
const FIELD: &'static str;
const ENGINE: &'static str;
}Expand description
ONE SLOT of a declaration: an elected field, and the engine that holds it.
A derived index’s expansion emits one zero-sized type per (elected field × declared engine) and
implements this on it. Nothing implements it by hand, and the trait is public because a
deployment NAMES one: opening a handle is SlotHandle<E, ThatSlot>, so the marker has to be
spellable wherever the handle is opened.
§Why slot identity is the PAIR, and what moved to get here
It used to be the declaration — one name per index, and one declaration, one slot was the law the brand rested on. The engine grammar re-keys it, because a declaration may now name several engines and a deployment may run more than one of them at once. Both halves are load-bearing:
- the FIELD, because the per-slot laws are per-corpus. ONE Tantivy index per slot is BM25’s
own arithmetic —
docfreqovernumdocs, and the length normalization’s average — and those statistics are index-wide, so two fields sharing one index move each other’s scores. Splitting by field is what lets a title and a body be searched independently. - the ENGINE, because two engines holding one field are two corpora with nothing in common. A name shared between them would have one engine’s write land in the other’s store, which is the wrong-write class the brand exists for.
The COLUMN axis is one grain FINER and is untouched: a vector slot may hold several columns, and
VectorColumn still says which one a knn runs over. This is the axis
above it, not a replacement for the one below.
§It NAMES the pairing; it does not open it
Every constant here is a fact of the DECLARATION, so they exist in every build — including a build that compiled no engine at all. What such a build does not have is the engine to open the slot ON, which is the seam’s own refusal and not this one’s.
Required Associated Constants§
Sourceconst SLOT: &'static SlotName
const SLOT: &'static SlotName
The slot’s durable NAME — what the engine makes a directory, a table or an index out of.
E0080 at the declaration for a malformed one: see SlotName::new.
Sourceconst ENGINE: &'static str
const ENGINE: &'static str
The ENGINE WORD this slot is written to, as the declaration spelled it.
The WORD rather than the engine type, and the asymmetry is the grammar’s: an engine word is bound to a concrete type by the deployment — shipped words under their own feature, everyone else’s at the graph root — and a slot is a fact of the declaration, which is written long before any of that is decided.
Required Associated Types§
Sourcetype Of: ?Sized
type Of: ?Sized
The DECLARATION this slot belongs to.
Carried so a door may demand the pairing rather than take it on trust: a signature written
S: Slot<Of = Self> admits this declaration’s slots and refuses another’s by name, which is
the brand’s guarantee stated where a caller can read it.
?Sized, because a declaration is only ever NAMED here.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".