Skip to main content

Child

Struct Child 

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

A running llama-server, killed on Drop so no orphan outlives us.

Implementations§

Source§

impl Child

Source

pub fn spawn(cfg: &Config) -> Result<Self, OcrError>

Spawns llama-server and waits until /health answers.

§Errors

OcrError::WeightsMissing when the GGUFs are absent, OcrError::BinaryMissing when the binary cannot be found, OcrError::SpawnFailed when the process will not start, and OcrError::NotReady when /health never answers in time.

Source

pub fn base_url(&self) -> String

The http://127.0.0.1:<port> root this child serves.

Source

pub fn touch(&mut self)

Records that the child was just used, restarting the idle countdown.

Source

pub fn idle_expired(&self, now: Instant) -> bool

True when the child has gone unused for longer than the idle timeout.

Source

pub fn set_busy(&mut self, busy: bool)

Marks the child as actively serving (or having finished) a request. While true, Child::should_reap always returns false: a request in flight must never have its child dropped out from under it.

Source

pub fn should_reap(&self, now: Instant) -> bool

True when this child is safe to drop: idle-expired and not currently serving a request.

Trait Implementations§

Source§

impl Drop for Child

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

Auto Trait Implementations§

§

impl Freeze for Child

§

impl RefUnwindSafe for Child

§

impl Send for Child

§

impl Sync for Child

§

impl Unpin for Child

§

impl UnsafeUnpin for Child

§

impl UnwindSafe for Child

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.