pub struct SubprocessTransport { /* private fields */ }Expand description
Subprocess-based transport for Claude CLI
Implementations§
Source§impl SubprocessTransport
impl SubprocessTransport
Sourcepub fn new(options: ClaudeCodeOptions) -> Result<Self>
pub fn new(options: ClaudeCodeOptions) -> Result<Self>
Create a new subprocess transport
Sourcepub fn subscribe_messages(
&self,
) -> Option<Pin<Box<dyn Stream<Item = Result<Message>> + Send + 'static>>>
pub fn subscribe_messages( &self, ) -> Option<Pin<Box<dyn Stream<Item = Result<Message>> + Send + 'static>>>
Subscribe to messages without borrowing self (for lock-free consumption)
Sourcepub async fn receive_sdk_control_request(&mut self) -> Option<Value>
pub async fn receive_sdk_control_request(&mut self) -> Option<Value>
Receive SDK control requests
Sourcepub fn take_sdk_control_receiver(&mut self) -> Option<Receiver<Value>>
pub fn take_sdk_control_receiver(&mut self) -> Option<Receiver<Value>>
Take the SDK control receiver (can only be called once)
Sourcepub fn with_cli_path(
options: ClaudeCodeOptions,
cli_path: impl Into<PathBuf>,
) -> Self
pub fn with_cli_path( options: ClaudeCodeOptions, cli_path: impl Into<PathBuf>, ) -> Self
Create with a specific CLI path
Sourcepub fn set_close_stdin_after_prompt(&mut self, close: bool)
pub fn set_close_stdin_after_prompt(&mut self, close: bool)
Set whether to close stdin after sending the initial prompt
Sourcepub fn for_print_mode(
options: ClaudeCodeOptions,
_prompt: String,
) -> Result<Self>
pub fn for_print_mode( options: ClaudeCodeOptions, _prompt: String, ) -> Result<Self>
Create transport for simple print mode (one-shot query)
Trait Implementations§
Source§impl Drop for SubprocessTransport
impl Drop for SubprocessTransport
Source§impl Transport for SubprocessTransport
impl Transport for SubprocessTransport
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Get self as Any for downcasting
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the Claude CLI
Source§fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: InputMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: InputMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a message to Claude
Source§fn receive_messages(
&mut self,
) -> Pin<Box<dyn Stream<Item = Result<Message>> + Send + 'static>>
fn receive_messages( &mut self, ) -> Pin<Box<dyn Stream<Item = Result<Message>> + Send + 'static>>
Receive messages from Claude as a stream
Source§fn send_control_request<'life0, 'async_trait>(
&'life0 mut self,
request: ControlRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_control_request<'life0, 'async_trait>(
&'life0 mut self,
request: ControlRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a control request (e.g., interrupt)
Source§fn receive_control_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<ControlResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive_control_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<ControlResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive control responses
Source§fn send_sdk_control_request<'life0, 'async_trait>(
&'life0 mut self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_sdk_control_request<'life0, 'async_trait>(
&'life0 mut self,
request: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send an SDK control request (for control protocol)
Source§fn send_sdk_control_response<'life0, 'async_trait>(
&'life0 mut self,
response: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_sdk_control_response<'life0, 'async_trait>(
&'life0 mut self,
response: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send an SDK control response
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the transport is connected
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from the Claude CLI
Auto Trait Implementations§
impl Freeze for SubprocessTransport
impl !RefUnwindSafe for SubprocessTransport
impl Send for SubprocessTransport
impl Sync for SubprocessTransport
impl Unpin for SubprocessTransport
impl !UnwindSafe for SubprocessTransport
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