Skip to main content

AdapterHost

Struct AdapterHost 

Source
pub struct AdapterHost {
    pub state: SessionState,
    pub last_error: Option<String>,
    /* private fields */
}
Expand description

Owns one adapter and feeds normalized events through the deterministic core reducer. The UI consumes effects and state snapshots.

Fields§

§state: SessionState§last_error: Option<String>

Implementations§

Source§

impl AdapterHost

Source

pub fn new(adapter: Box<dyn AgentAdapter>, event_log: Option<EventLog>) -> Self

Source

pub async fn start(&mut self) -> AdapterResult<()>

Source

pub async fn send_prompt(&mut self, prompt: String) -> AdapterResult<()>

Source

pub async fn cancel(&mut self) -> AdapterResult<bool>

Source

pub async fn answer_permission( &mut self, request_id: String, answer: PermissionAnswer, ) -> AdapterResult<()>

Source

pub async fn set_mode(&mut self, mode: String) -> AdapterResult<()>

Source

pub async fn reload(&mut self) -> AdapterResult<()>

Source

pub async fn stop(&mut self) -> AdapterResult<()>

Source

pub async fn next_effects(&mut self) -> Option<AdapterResult<Vec<Effect>>>

Source

pub async fn next_update(&mut self) -> Option<AdapterResult<HostUpdate>>

Source

pub fn adapter(&self) -> &dyn AgentAdapter

Source

pub fn session_id(&self) -> Option<String>

Trait Implementations§

Source§

impl Debug for AdapterHost

Source§

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

Formats the value using the given formatter. Read more

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> 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, <T as TryFrom<U>>::Error>

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.