§ What This Binding Does Not Expose
These C entry points also take a deferred completion, but the crate calls them blocking, whatever receiver you hold:
- The
load_*family,view_nvme,metadataandmetadata_buffer, with each load config’sexecutorchoosing where it fans out. clear, which runs on the calling thread under&mut DenseIndex.- Cursor and search-stream pulls, which run on the executor of the receiver that opened them, and open only from a blocking one.
init_ram, init_vram and view_ram block in C as well.
§ Design
- A thin layer over the C ABI. Every name follows
c/usearch/: a C verbusearch_dense_<verb>is a<verb>here, each module mirrors one header, a verb’s argument struct becomes itsDense*Config, and every wrapper’s documentation names the C symbol it calls. Enums mirror C enums, never strings. - The receiver chooses, the verb stays.
&DenseIndexruns a verb on the calling thread,on(&executor)blocks on an executor, anddeferred(&executor)submits it, all with the same arguments. - Deferred calls use the language’s own idioms.
statuspolls throughusearch_outcome_status,waitblocks throughusearch_outcome_wait, and aDeferredisIntoFuture, so.awaitpolls the status word, since the library has no wake-up. - No life of its own. The binding starts no threads and keeps no queues; releasing a
DeferredridesDrop, which waits for the call first. - Arenas are lent and reused, never shared. Every output whose length scales with the call lands in an arena the caller passes; the result borrows it, so the borrow checker retires stale views at compile time.
- Nothing costs anything until it is used. Blocking calls allocate no box, and an arena allocates only when a call writes into it.
- Callers lend memory, never an allocator. No allocation callback crosses into the library: payload belongs to the index, placed by its constructor’s residency, and scratch belongs to the executor.
- A deferred receiver refuses borrowed inputs at compile time. The
Acceptsbound admits only owned inputs, so a borrow the library would read after the verb returns never compiles.