Skip to main content

Engine

Struct Engine 

Source
pub struct Engine {
    pub word: Ident,
    pub road: Road,
    pub stored: bool,
    pub resource: Option<Path>,
    pub options: TokenStream,
    pub rrf: bool,
    pub lanes: Vec<DeclaredLane>,
}
Expand description

ONE engine block as a field declared it — the word, and whatever it carried.

Fields§

§word: Ident

The word, carrying its own span — where every refusal about this block lands.

§road: Road

The FROM-ROAD this block declares — Road::Identity where it declared none.

§stored: bool

stored — this engine KEEPS the original value, retrievable.

false unless the word was written, and the cheap default is the ruled one: only the computed result is guaranteed SEARCHABLE, and retrieval is opt-in. What it reaches in the shipped engine is tantivy’s STORED flag on the body field.

§resource: Option<Path>

resource = "path::To::Resource" — the RESOURCE this leg is written to, as the declaration POINTED at it.

§It POINTS; it does not TYPE. type = retired to get here

The word this replaces named an ENGINE directly, which put the kind of a store in two places: on the declaration that wrote the type, and on whatever the deployment actually opened. Kind is said once, at the resource — #[ingraph::resource(tantivy)] pub struct Ft; — and every other position POINTS at that declaration. So what a leg holds is the path of a resource, and the engine underneath it is the resource’s own business.

§What POINTING buys that TYPING did not

A slot’s package still publishes knobs in the store’s own currencies — a floor is a <Ft as FulltextEngine>::Score and a search input is that store’s own — and the projection is unchanged in shape: it simply runs off the RESOURCE type rather than off an engine type. Two facts come free with the move:

  • the KIND CHECK is the projection itself. <Ft as FulltextEngine>::Score is E0277 at the path the author wrote when Ft is a vector resource, so named → kind-verified needs no marker trait and no check anyone can forget to run;
  • two resources of ONE KIND are two TYPES and therefore two TypeIds, which is what lets a deployment run two stores of the same engine and keeps a door citizen’s Shared<R> lookup unambiguous. A word bound to a type could not say that.

§None is the ordinary state, and it is the SOLE-DEFAULT’s condition

An unpointed leg contributes no variant and a slot whose legs are all unpointed grows no engine seat at all — the presence law, unchanged. What is new is that saying nothing is no longer only a fallback: a deployment declaring exactly ONE resource of this leg’s kind binds it by that fact alone, and zero or several is a START-UP refusal listing the candidates. See the binding laws on FieldEngines.

REFER-QUOTED, so the path resolves at the span its author wrote and a path naming nothing is E0412 there rather than inside an expansion.

§options: TokenStream

The block’s contents, UNINTERPRETED, and empty where the word was written bare.

§Verbatim, and it could not be otherwise

hnsw(ef = 200) names a knob of an engine this crate has never heard of. Reading it would mean carrying every engine’s option set here — the maintenance an open vocabulary exists to avoid — and refusing what it could not read would close the vocabulary through the back door. So the tokens are carried to the binding and interpreted by whoever owns the engine, which is the same division the framework already draws around a backend’s own words.

A proc_macro2::TokenStream rather than parsed pairs, therefore, and the spans inside it are the author’s own — so an engine that refuses one of its knobs refuses it where it was written.

§It is the block MINUS the framework’s own words, and that is not a hole in the argument

road and stored are written inside these parentheses and are taken out of what is carried. The division is the same one the outer walk already draws: a FRAMEWORK word has one meaning wherever it appears, and an engine’s knob has whatever meaning its engine gives it. Reading ef = 200 would mean carrying every engine’s option set here; reading stored means carrying one word whose meaning the framework defines, and whose whole point is that it means the same thing to every engine that has a doc store.

The price is stated rather than hidden: an engine with a knob of its own called stored, join, multi, from, try_from, resource or lanes cannot spell it here, because the framework claimed the spelling first. That is the ordinary cost of a shared namespace, and it is bounded by seven words.

§rrf: bool

rrf = <bool> — whether this leg enters the FUSED ROAD of the slot it holds.

§It is LEADERBOARD MEMBERSHIP and nothing else

A fanned slot writes every declared engine at once. What that fan is FOR is two different things and the declaration could not say which: a leaderboard, where each engine’s ranking is separate evidence and the fold joins them; or REDUNDANCY, where the same content lives in several stores and a read comes from one of them. rrf = false is the second — the leg is written and is not a route.

§TRUE by absence, per the de-Option law

A bool rather than an Option<bool>: there is no third state. The default is the shape a fan already had before the word existed, so a declaration that says nothing keeps exactly the slot it had — which is what makes the word purely additive.

§ORTHOGONAL to resource, and all four quadrants mean something

resource = is ADDRESSABILITY (and the Score projection a package publishes floors in); rrf = is leaderboard membership. A pointed leg outside the leaderboard is directly readable and does not rank; an unpointed leg inside it ranks and cannot be named by a request; a leg that is neither is written for redundancy alone.

§lanes: Vec<DeclaredLane>

lanes(zh(accepts(cmn)), en, rest(catch_all)) — the PARTITIONS this leg’s corpus is cut into, in declaration order, and EMPTY where the word was not written.

§Presence is the whole state, and absence is the corpus that always was

An empty list is a declaration that said nothing about lanes, and what it mints is nothing: the slot takes Lanes’ own default, which is ONE lane keyed und. So the word is purely additive — a leg that never wrote it emits, indexes and answers exactly as it did before the word existed.

§The KEY and the ALIASES are read; the ANALYZER is not here

A lane’s EXISTENCE shapes the slot, so it is a compile-time fact and this grammar reads it. Its INSTANCE is a value a deployment builds at boot, so a tokenizer = "…" written inside a lane is the ENGINE’s knob and rides options with every other one — the same partition the block around it already draws, one grain down. That division is the ruling’s own: a lane’s existence is a declaration fact, its instance an assembly one.

Implementations§

Source§

impl Engine

Source

pub fn bare(word: Ident) -> Self

A block written BARE — tantivy with no parentheses at all.

The most common shape by far, and the one every default is defined against: the identity road, nothing kept, NOTHING POINTED AT, no knobs carried, no lanes cut, and IN the fused road. A named constructor rather than a Default, because the WORD is not defaultable and a partial default would be the thing that quietly disagrees with the grammar when an eighth framework word arrives.

Source

pub fn shipped(&self) -> Option<EngineKind>

The shipped engine this word names, or None for a word bound at the graph root.

Trait Implementations§

Source§

impl Clone for Engine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Engine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.