pub struct Embedder { /* private fields */ }Expand description
Starts one worker on first use and keeps it; a second caller waits for it.
Implementations§
Source§impl Embedder
impl Embedder
Sourcepub const fn new(settings: Option<Settings>) -> Self
pub const fn new(settings: Option<Settings>) -> Self
An embedder with settings; None refuses every request by name.
Nothing is started until the first request.
Sourcepub fn embed(&self, kind: Kind, texts: &[String]) -> Result<Embedded, Failure>
pub fn embed(&self, kind: Kind, texts: &[String]) -> Result<Embedded, Failure>
The vectors of texts, all of them in the order given, or a refusal.
A kept worker found dead before any byte of a batch reached it is replaced, once, and the batch goes to the new one: a worker that died between requests costs no request. One that dies with a batch answers by name, and that batch is never sent again.
§Errors
embed_unavailable with nothing configured; embed_request_empty,
embed_request_too_large, check_embed’s own name, or a text’s own
refusal before anything is sent, with any kept worker left running;
embed_busy past the waiting bound; a start’s refusal; any ending of
the worker, by name, after which the next request starts another.
Sourcepub fn last_ending(&self) -> Option<Ending>
pub fn last_ending(&self) -> Option<Ending>
The last way a worker ended: its name, exit status and the end of its stderr, for an operator. No caller’s answer carries the stderr.