Skip to main content

HasPeer

Trait HasPeer 

Source
pub trait HasPeer<Peer: Role>: Role {
    // Required method
    fn remote_style(&self, peer: Peer) -> RemoteStyle;
}
Expand description

Declares that a role can send messages to a specific peer.

Most roles only communicate with their counterpart, but some (like acp::Proxy) can communicate with multiple peers:

  • Proxy: HasPeer<Client> - proxy can send/receive from clients
  • Proxy: HasPeer<Agent> - proxy can send/receive from agents
  • Proxy: HasPeer<Conductor> - proxy can send/receive from its conductor

The RemoteStyle determines how messages are transformed:

Required Methods§

Source

fn remote_style(&self, peer: Peer) -> RemoteStyle

Returns the remote style for sending to this peer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl HasPeer<Agent> for Agent

Source§

impl HasPeer<Agent> for Conductor

Source§

impl HasPeer<Client> for agent_client_protocol::role::acp::Client

Source§

impl HasPeer<Client> for Conductor

Source§

impl HasPeer<Proxy> for Proxy

Source§

impl HasPeer<Client> for agent_client_protocol::role::mcp::Client

Source§

impl HasPeer<Server> for Server

Source§

impl HasPeer<UntypedRole> for UntypedRole