pub struct DynConnectTo<R: Role> { /* private fields */ }Expand description
A dynamically-typed component for heterogeneous collections.
This type wraps any ConnectTo implementation and provides dynamic dispatch,
allowing you to store different component types in the same collection.
The type parameter R is the role that all components in the
collection serve (their counterpart).
§Examples
ⓘ
use agent_client_protocol::{DynConnectTo, Client};
let components: Vec<DynConnectTo<Client>> = vec![
DynConnectTo::new(Proxy1),
DynConnectTo::new(Proxy2),
DynConnectTo::new(Agent),
];Implementations§
Trait Implementations§
Source§impl<R: Role> ConnectTo<R> for DynConnectTo<R>
impl<R: Role> ConnectTo<R> for DynConnectTo<R>
Source§async fn connect_to(self, client: impl ConnectTo<R::Counterpart>) -> Result<()>
async fn connect_to(self, client: impl ConnectTo<R::Counterpart>) -> Result<()>
Serve this component by forwarding to a client component. Read more
Auto Trait Implementations§
impl<R> Freeze for DynConnectTo<R>
impl<R> !RefUnwindSafe for DynConnectTo<R>
impl<R> Send for DynConnectTo<R>
impl<R> !Sync for DynConnectTo<R>
impl<R> Unpin for DynConnectTo<R>where
R: Unpin,
impl<R> UnsafeUnpin for DynConnectTo<R>
impl<R> !UnwindSafe for DynConnectTo<R>
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