Skip to main content

AgentDescription

Struct AgentDescription 

Source
pub struct AgentDescription {
    pub commands: Vec<DescribedCommand>,
    pub flags: Vec<DescribedFlag>,
    pub secrets: Vec<DescribedSecret>,
    pub conflicts: Vec<String>,
}
Expand description

What a built agent’s plugins add to the command line, as the agent writes it when the launcher sets env::DESCRIBE: their commands, their options and the secrets they ask for, and the plugins whose agent-loop systems clash, for rig plugin check --build. The launcher keeps one per build (Home::described) and reads the command line against it.

The text form is a header line, then one line each, its fields separated by tabs (shown here as ⇥):

rig-describe 1
command ⇥ stats ⇥ - ⇥ headless ⇥ sessionless ⇥ Count the saved sessions
flag ⇥ remote ⇥ HOST:PATH ⇥ Work in a directory on another machine over SSH
secret ⇥ crypt ⇥ Passphrase for this machine's sessions
conflict ⇥ `a::APlugin` and `b::BPlugin`: a::count and b::reset, on b::Tally

Fields§

§commands: Vec<DescribedCommand>

The plugins’ commands.

§flags: Vec<DescribedFlag>

The plugins’ options, the fronts’ included.

§secrets: Vec<DescribedSecret>

The secrets the plugins ask for.

§conflicts: Vec<String>

Each pair of systems of one agent-loop stage that use the same data with no order between them, one writing it, naming their plugins.

Implementations§

Source§

impl AgentDescription

Source

pub fn parse(text: &str) -> Self

Reads a report. Without the header it is empty: a build from before commands, which has none. A record of a kind it does not know is skipped, and fields after those it knows are ignored, so a later version can add both.

Source

pub fn write(&self) -> String

The report as text, which Self::parse reads back. Tabs and line breaks in a field become spaces.

Source

pub fn command(&self, name: &str) -> Option<&DescribedCommand>

The command name, if a plugin adds it.

Source

pub fn invocation<S: AsRef<str>>( &self, args: &[S], ) -> Result<Invocation, String>

Reads the user’s command line, without the launcher’s own first word, against this agent, into the canonical Invocation. -p, -m and -r (Self::resume) are the launcher’s; a plugin option takes a value as --name=VALUE, or as the next word when it takes one (--name VALUE); without -p, the first other word is a command, and every later word is its argument. An option or command no plugin adds, and a launcher’s word as a command, are refused.

Source

pub fn resume<S: AsRef<str>>(&self, args: &[S]) -> Option<String>

The session -r <id|name> (or --resume) names on the command line args, read as Self::invocation reads it: wherever an option goes, so not after -- or among a command’s words. This build’s options that take a value take the next word as theirs; an option it does not know takes none. None without -r, or when the command line cannot be read.

Source

pub fn usage(&self) -> String

What rig help lists of the build: the plugins’ commands, their options, and the secrets they ask for, each with the variable that gives it (never its value).

Source

pub fn command_names(&self) -> Vec<&str>

The launcher’s commands, then the plugins’.

Trait Implementations§

Source§

impl Clone for AgentDescription

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 AgentDescription

Source§

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

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

impl Default for AgentDescription

Source§

fn default() -> Self

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

impl Eq for AgentDescription

Source§

impl PartialEq for AgentDescription

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 AgentDescription

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.