Skip to main content

PromptHost

Trait PromptHost 

Source
pub trait PromptHost: Send + Sync {
    // Required methods
    fn can_ask(&self) -> bool;
    fn approver(&self) -> Box<dyn Approver>;
}
Expand description

How a process answers Approve::Prompt while it executes a task’s turns, and whether there is anyone there to ask at all.

The executor is whichever process holds a task’s attach lock (ADR-0019), and only that process’s own environment knows whether a person — or any other approving party — is behind it. A library has no terminal to ask at (ADR-0011, the same reason basis-cli’s TerminalApprover lives in the binary and not in basis), so basis-tasks does not decide this; a host that wants Prompt to work supplies one via Tasks::with_prompt_host. A Tasks with none refuses Prompt the same way an unaskable process always did — safely, and by name.

Required Methods§

Source

fn can_ask(&self) -> bool

Whether this process can currently put a question to whoever answers for it. Checked before a Prompt-mode task is allowed to spawn, and again at every attach.

Source

fn approver(&self) -> Box<dyn Approver>

The approver used for one task’s turns while this process drives it. Called once per attach, only when can_ask said yes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§