Skip to main content

Command

Struct Command 

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

A local model behind a program: argv[0] with the rest as arguments, run once per call. It gets a JSON array of strings on standard input and must print a JSON array of number arrays, one per string, all dimension long, and exit 0 within the timeout.

Implementations§

Source§

impl Command

Source

pub const DEFAULT_TIMEOUT: Duration

Source

pub fn new( argv: Vec<String>, dimension: usize, timeout: Duration, ) -> Result<Command, Error>

Trait Implementations§

Source§

impl Debug for Command

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Embedder for Command

Source§

fn model(&self) -> &str

Names the model, so vectors from another one are never compared with these: static:<file name> or local:<program>.
Source§

fn dimension(&self) -> usize

Source§

fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, Error>

One vector per text, in order, each dimension long. A text the model has nothing for gets zeros.

Auto Trait Implementations§

§

impl Forget for Command

§

impl Freeze for Command

§

impl Move for Command

§

impl RefUnwindSafe for Command

§

impl Send for Command
where RawVecInner: Send,

§

impl Sync for Command
where RawVecInner: Sync,

§

impl Unpin for Command
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Command

§

impl UnwindSafe for Command
where RawVecInner: UnwindSafe,

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> 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, 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.