pub struct Client;Expand description
The client role - typically an IDE or CLI that controls an agent.
Clients send prompts and receive responses from agents.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder(self) -> Builder<Client, NullHandler, NullRun>
pub fn builder(self) -> Builder<Client, NullHandler, NullRun>
Create a connection builder for a client.
Sourcepub fn v2(self) -> Builder<Client, NullHandler, NullRun>
Available on crate feature unstable_protocol_v2 only.
pub fn v2(self) -> Builder<Client, NullHandler, NullRun>
unstable_protocol_v2 only.Create a client builder that requires an ACP protocol v2 agent.
If the agent negotiates v1 during initialization, the initialize request resolves with an error so callers can choose an explicit v1 fallback path.
Requires the unstable_protocol_v2 crate feature.
Sourcepub fn protocol_connector(self) -> ClientProtocolConnector
Available on crate feature unstable_protocol_v2 only.
pub fn protocol_connector(self) -> ClientProtocolConnector
unstable_protocol_v2 only.Create a connector that chooses between configured protocol implementations.
Add implementation factories with ClientProtocolConnector::with_v1
and ClientProtocolConnector::with_v2. The resulting connector starts
the highest configured protocol implementation. If a v2 implementation
successfully negotiates v1 and a v1 implementation is configured, the
connector reuses the connection only when the v1 implementation’s
initialize metadata and capabilities match what the agent already saw;
otherwise it opens a fresh agent connection and restarts with v1.
Requires the unstable_protocol_v2 crate feature while protocol v2
stabilizes.
Sourcepub async fn connect_with<R>(
self,
agent: impl ConnectTo<Client>,
main_fn: impl AsyncFnOnce(ConnectionTo<Agent>) -> Result<R, Error>,
) -> Result<R, Error>
pub async fn connect_with<R>( self, agent: impl ConnectTo<Client>, main_fn: impl AsyncFnOnce(ConnectionTo<Agent>) -> Result<R, Error>, ) -> Result<R, Error>
Connect to agent and run main_fn with the ConnectionTo.
Returns the result of main_fn (or an error if something goes wrong).
Equivalent to self.builder().connect_with(agent, main_fn).
Trait Implementations§
Source§impl ConnectTo<Client> for AgentProtocolRouter
Available on crate feature unstable_protocol_v2 only.
impl ConnectTo<Client> for AgentProtocolRouter
unstable_protocol_v2 only.impl Copy for Client
impl Eq for Client
Source§impl HasPeer<Client> for Client
impl HasPeer<Client> for Client
Source§fn remote_style(&self, _peer: Client) -> RemoteStyle
fn remote_style(&self, _peer: Client) -> RemoteStyle
Source§impl HasPeer<Client> for Conductor
impl HasPeer<Client> for Conductor
Source§fn remote_style(&self, _peer: Client) -> RemoteStyle
fn remote_style(&self, _peer: Client) -> RemoteStyle
Source§impl Ord for Client
impl Ord for Client
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Client
impl PartialOrd for Client
Source§impl Role for Client
impl Role for Client
Source§type Counterpart = Agent
type Counterpart = Agent
Source§async fn default_handle_dispatch_from(
&self,
message: Dispatch,
_connection: ConnectionTo<Client>,
) -> Result<Handled<Dispatch>, Error>
async fn default_handle_dispatch_from( &self, message: Dispatch, _connection: ConnectionTo<Client>, ) -> Result<Handled<Dispatch>, Error>
Source§fn counterpart(&self) -> Self::Counterpart
fn counterpart(&self) -> Self::Counterpart
impl StructuralPartialEq for Client
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.