pub trait Transport {
// Required methods
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 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 receive_messages(
&mut self,
) -> Pin<Box<dyn Stream<Item = Result<HashMap<String, Value>, ClaudeSDKError>> + Send + '_>>;
fn is_connected(&self) -> bool;
// Provided method
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 { ... }
}Expand description
Abstract transport for Claude communication
Required Methods§
Sourcefn 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,
Initialize connection
Sourcefn 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,
Close connection
Sourcefn 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 Claude
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if transport is connected
Provided Methods§
Sourcefn 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)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".