pub trait Role:
Debug
+ Clone
+ Send
+ Sync
+ 'static
+ Eq
+ Ord
+ Hash {
type Counterpart: Role<Counterpart = Self>;
// Required methods
fn role_id(&self) -> RoleId;
fn default_handle_dispatch_from(
&self,
message: Dispatch,
connection: ConnectionTo<Self>,
) -> impl Future<Output = Result<Handled<Dispatch>, Error>> + Send;
fn counterpart(&self) -> Self::Counterpart;
// Provided method
fn builder(self) -> Builder<Self>
where Self: Sized { ... }
}Expand description
The role that an endpoint plays in an ACP connection.
Roles are the fundamental building blocks of ACP’s type system:
acp::Clientconnects toacp::Agentacp::Agentconnects toacp::Clientacp::Proxyconnects toacp::Conductoracp::Conductorconnects toacp::Proxy
Each role determines:
- Who the counterpart is (via
Role::Counterpart) - How unhandled messages are processed (via
Role::default_message_handler)
Required Associated Types§
Sourcetype Counterpart: Role<Counterpart = Self>
type Counterpart: Role<Counterpart = Self>
The role that this endpoint connects to.
For example:
Client::Counterpart = AgentAgent::Counterpart = ClientProxy::Counterpart = ConductorConductor::Counterpart = Proxy
Required Methods§
Sourcefn default_handle_dispatch_from(
&self,
message: Dispatch,
connection: ConnectionTo<Self>,
) -> impl Future<Output = Result<Handled<Dispatch>, Error>> + Send
fn default_handle_dispatch_from( &self, message: Dispatch, connection: ConnectionTo<Self>, ) -> impl Future<Output = Result<Handled<Dispatch>, Error>> + Send
Method invoked when there is no defined message handler.
Sourcefn counterpart(&self) -> Self::Counterpart
fn counterpart(&self) -> Self::Counterpart
Returns the counterpart role.
Provided Methods§
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.