pub struct ClaudeSDKClientWorking { /* private fields */ }Expand description
Working interactive client
Implementations§
Source§impl ClaudeSDKClientWorking
impl ClaudeSDKClientWorking
Sourcepub fn new(options: ClaudeCodeOptions) -> Self
pub fn new(options: ClaudeCodeOptions) -> Self
Create a new client
Sourcepub async fn connect(&mut self, initial_prompt: Option<String>) -> Result<()>
pub async fn connect(&mut self, initial_prompt: Option<String>) -> Result<()>
Connect to Claude
Sourcepub async fn send_user_message(&mut self, prompt: String) -> Result<()>
pub async fn send_user_message(&mut self, prompt: String) -> Result<()>
Send a user message
Sourcepub async fn receive_message(&mut self) -> Result<Option<Message>>
pub async fn receive_message(&mut self) -> Result<Option<Message>>
Receive next message
Sourcepub async fn receive_response(&mut self) -> Result<Vec<Message>>
pub async fn receive_response(&mut self) -> Result<Vec<Message>>
Receive all messages until result
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if connected
Auto Trait Implementations§
impl Freeze for ClaudeSDKClientWorking
impl !RefUnwindSafe for ClaudeSDKClientWorking
impl Send for ClaudeSDKClientWorking
impl Sync for ClaudeSDKClientWorking
impl Unpin for ClaudeSDKClientWorking
impl !UnwindSafe for ClaudeSDKClientWorking
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