pub trait Embedder: Send + Sync {
// Required methods
fn identity(&self) -> EmbedderIdentity;
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>;
}Expand description
Minimal trait any embedder implementation must satisfy. Returns
vectors in the same order as the input texts.
Implementations are expected to be cheap to clone / Send + Sync
when they wrap thread-safe state; the engine holds an Arc<dyn Embedder> on the handle via [Mnemo::set_embedder]. See
[Mnemo::remember_text] for the full user-facing contract.
Required Methods§
Sourcefn identity(&self) -> EmbedderIdentity
fn identity(&self) -> EmbedderIdentity
This embedder’s observable identity (name, dims, normalize).
Must be stable for the lifetime of the embedder — mnemo caches
it on set_embedder and does not re-query per call.
Sourcefn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
Embed texts, returning one vector per input in the same order.
Caller-level errors (network failure for a hosted embedder, OOM
in a local model) should bubble up as MnemoError::Invalid
with a short message — the specific crypto / page errors in
MnemoError are reserved for the engine’s own concerns.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".