Skip to main content

EmbedCmd

Struct EmbedCmd 

Source
pub struct EmbedCmd { /* private fields */ }
Expand description

Persistent-child-process adapter for a user-supplied embedder command. See the module docs for the protocol.

Implementations§

Source§

impl EmbedCmd

Source

pub fn new(cmd: &str, identity: EmbedderIdentity) -> Result<Self>

Spawn cmd (a shell-style command string: "python3 embedder.py" or "my-tool --model=foo") and prepare it to accept embed requests. The command is split by whitespace and single/double quotes — see [shlex_split] — and the program is launched directly, not through a shell. On Windows this means forward-slash paths work; on Unix it means no ~ expansion and no environment-variable substitution.

identity is the EmbedderIdentity this adapter will report; it is matched against the database’s manifest by crate::Mnemo::set_embedder. Pick values that describe what the child process actually computes — mismatched identities would corrupt recall silently.

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Replace the per-request timeout. See DEFAULT_EMBED_TIMEOUT.

Trait Implementations§

Source§

impl Drop for EmbedCmd

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Embedder for EmbedCmd

Source§

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.
Source§

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.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V