Skip to main content

Invocation

Struct Invocation 

Source
pub struct Invocation {
    pub print: Option<String>,
    pub model: Option<String>,
    pub flags: Vec<(String, Option<String>)>,
    pub command: Option<String>,
    pub arguments: Vec<String>,
}
Expand description

The agent’s arguments, in the canonical form the launcher passes on (Invocation::to_args): the model, each plugin option as --name=VALUE, then the print prompt after --print --, or a plugin’s command and its arguments. The launcher reads the user’s command line against the agent’s AgentDescription report first (AgentDescription::invocation), so rig -p "…" and the agent binary run alone agree on them.

Fields§

§print: Option<String>

Some for print mode: answer this one prompt, then exit, with the answer on stdout and text piped in on stdin after the prompt (which may be empty when stdin is piped). None runs the terminal view, or no view at all without one.

§model: Option<String>

A catalog model (vendor/model) for the session’s first agent.

§flags: Vec<(String, Option<String>)>

The options of the agent’s plugins, in the order given: each --name with its value, if any. The agent refuses one no plugin of its build takes.

§command: Option<String>

A plugin’s command, rig <command> …, which chooses the front that runs.

§arguments: Vec<String>

The words after the command, as given.

Implementations§

Source§

impl Invocation

Source

pub fn parse<S: AsRef<str>>(args: &[S]) -> Result<Self, String>

Reads the agent’s arguments in their canonical form, without the program name: a plugin option’s value comes after =. Without --print, the first other word is a command, and every word after it is the command’s.

Source

pub fn from_env() -> Result<Self, String>

The agent’s own arguments, from the process’s.

Source

pub fn is_headless(&self) -> bool

Whether nobody sits at a terminal view, and the run ends by itself.

Source

pub fn to_args(&self) -> Vec<OsString>

The arguments that Self::parse reads back as self.

Trait Implementations§

Source§

impl Clone for Invocation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Invocation

Source§

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

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

impl Default for Invocation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Invocation

Source§

impl PartialEq for Invocation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Invocation

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.