pub struct SubprocessCLITransport { /* private fields */ }Expand description
Subprocess transport using Claude Code CLI
Implementations§
Source§impl SubprocessCLITransport
impl SubprocessCLITransport
Sourcepub fn new(
prompt: &str,
options: ClaudeCodeOptions,
cli_path: Option<&str>,
) -> Result<Self, ClaudeSDKError>
pub fn new( prompt: &str, options: ClaudeCodeOptions, cli_path: Option<&str>, ) -> Result<Self, ClaudeSDKError>
Create a new subprocess transport
Sourcepub fn with_safety_limits(self, limits: SafetyLimits) -> Self
pub fn with_safety_limits(self, limits: SafetyLimits) -> Self
Set custom safety limits for this transport
Sourcepub fn try_parse_json_buffer(
&mut self,
) -> Option<Result<HashMap<String, Value>, ClaudeSDKError>>
pub fn try_parse_json_buffer( &mut self, ) -> Option<Result<HashMap<String, Value>, ClaudeSDKError>>
Try to parse accumulated JSON buffer, handling multiline JSON
Sourcepub fn process_line(
&mut self,
line: String,
) -> Option<Result<HashMap<String, Value>, ClaudeSDKError>>
pub fn process_line( &mut self, line: String, ) -> Option<Result<HashMap<String, Value>, ClaudeSDKError>>
Process a single line and update JSON buffer state
Trait Implementations§
Source§impl Transport for SubprocessCLITransport
impl Transport for SubprocessCLITransport
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start subprocess
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Terminate subprocess
Source§fn receive_messages(
&mut self,
) -> Pin<Box<dyn Stream<Item = Result<HashMap<String, Value>, ClaudeSDKError>> + Send + '_>>
fn receive_messages( &mut self, ) -> Pin<Box<dyn Stream<Item = Result<HashMap<String, Value>, ClaudeSDKError>> + Send + '_>>
Receive messages from CLI
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if subprocess is running
Source§fn send_request<'life0, 'async_trait>(
&'life0 mut self,
_messages: Vec<HashMap<String, Value>>,
_options: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn send_request<'life0, 'async_trait>(
&'life0 mut self,
_messages: Vec<HashMap<String, Value>>,
_options: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<(), ClaudeSDKError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Send request to Claude (not used for CLI transport - args passed via command line)
Auto Trait Implementations§
impl Freeze for SubprocessCLITransport
impl !RefUnwindSafe for SubprocessCLITransport
impl Send for SubprocessCLITransport
impl Sync for SubprocessCLITransport
impl Unpin for SubprocessCLITransport
impl !UnwindSafe for SubprocessCLITransport
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