pub struct InteractiveClient { /* private fields */ }Expand description
Interactive client for stateful conversations with Claude
This is the recommended client for interactive use. It provides a clean API that matches the Python SDK’s functionality.
Implementations§
Source§impl InteractiveClient
impl InteractiveClient
Sourcepub fn new(options: ClaudeCodeOptions) -> Result<Self>
pub fn new(options: ClaudeCodeOptions) -> Result<Self>
Create a new client
Sourcepub async fn send_and_receive(&mut self, prompt: String) -> Result<Vec<Message>>
pub async fn send_and_receive(&mut self, prompt: String) -> Result<Vec<Message>>
Send a message and receive all messages until Result message
Sourcepub async fn send_message(&mut self, prompt: String) -> Result<()>
pub async fn send_message(&mut self, prompt: String) -> Result<()>
Send a message without waiting for response
Sourcepub async fn receive_response(&mut self) -> Result<Vec<Message>>
pub async fn receive_response(&mut self) -> Result<Vec<Message>>
Receive messages until Result message (convenience method like Python SDK)
Sourcepub async fn interrupt(&mut self) -> Result<()>
pub async fn interrupt(&mut self) -> Result<()>
Send interrupt signal to cancel current operation
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect
Auto Trait Implementations§
impl Freeze for InteractiveClient
impl !RefUnwindSafe for InteractiveClient
impl Send for InteractiveClient
impl Sync for InteractiveClient
impl Unpin for InteractiveClient
impl !UnwindSafe for InteractiveClient
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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