Skip to main content

ToolClient

Struct ToolClient 

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

A running tool.

Implementations§

Source§

impl ToolClient

Source

pub fn start(program: &str, args: &[&str]) -> Result<Self, String>

Starts program args… (dspk tool serve, or podman run … dspk tool serve) and shakes hands: its description is read, its tool protocol checked, its operations checked.

Source

pub fn description(&self) -> &ToolDescription

Source

pub fn validate( &mut self, operation: &str, recipe: &Value, ) -> Result<Validation, String>

Whether recipe is one operation can run, and if not, why.

Source

pub fn run( &mut self, request: &RunRequest, progress: &mut dyn FnMut(&str, Option<f32>), ) -> Result<RunReport, String>

Runs request: its inputs are checked against the operation’s ports first, its report against the operation’s outputs after. progress sees the tool’s progress events.

Source

pub fn alive(&mut self) -> bool

Whether the program is still running (a crash ends it; start it again).

Auto Trait Implementations§

§

impl Forget for ToolClient

§

impl Freeze for ToolClient

§

impl Move for ToolClient

§

impl RefUnwindSafe for ToolClient
where I32NotAllOnes: RefUnwindSafe,

§

impl Send for ToolClient
where RawVecInner: Send, I32NotAllOnes: Send, BoxRaw<[MaybeUninit<u8>]>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send,

§

impl Sync for ToolClient
where RawVecInner: Sync, I32NotAllOnes: Sync, BoxRaw<[MaybeUninit<u8>]>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync,

§

impl Unpin for ToolClient
where *const u8 is !null: Unpin, I32NotAllOnes: Unpin, Box<[MaybeUninit<u8>]>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin,

§

impl UnsafeUnpin for ToolClient

§

impl UnwindSafe for ToolClient
where RawVecInner: UnwindSafe, I32NotAllOnes: UnwindSafe, BoxRaw<[MaybeUninit<u8>]>: UnwindSafe, BTreeMap<String, Value>: 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> 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.