pub struct ChatActor {
pub tx: UnboundedSender<ChatActorMessage>,
pub cancel_tx: UnboundedSender<()>,
}Expand description
The ChatActor implements the core (or backend) of tycode.
Tycode UI applications (such as the CLI and VSCode extension) do not contain any application logic; instead they are simple UI wrappers that take input from the user, send it to the actor, and render events from the actor back in to the UI.
The interface to the actor is essentially two channels: an input and output
channel. ChatActorMessage are sent to the input channel by UI
applications and ChatEvents are emitted by the actor to the output queue.
The ChatActor struct wraps the input channel and provides some convenience
methods and offers cancellation (technically there is a third cancellation
channel, however that is encapsulated by the ChatActor). Events from the
actor are received through a mpsc::UnboundedReceiver<ChatEvent> which is
returned when the actor is launched.
Fields§
§tx: UnboundedSender<ChatActorMessage>§cancel_tx: UnboundedSender<()>Implementations§
Source§impl ChatActor
impl ChatActor
pub fn send_message(&self, message: String) -> Result<()>
pub fn send_message_with_images( &self, message: String, images: Vec<ImageData>, ) -> Result<()>
pub fn change_provider(&self, provider: String) -> Result<()>
pub fn get_settings(&self) -> Result<()>
pub fn save_settings(&self, settings: Value, persist: bool) -> Result<()>
pub fn cancel(&self) -> Result<()>
pub fn get_module_schemas(&self) -> Result<()>
Auto Trait Implementations§
impl Freeze for ChatActor
impl RefUnwindSafe for ChatActor
impl Send for ChatActor
impl Sync for ChatActor
impl Unpin for ChatActor
impl UnwindSafe for ChatActor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more