pub struct LocalTransport { /* private fields */ }Expand description
In-process collaboration transport backed by a broadcast channel.
This is the phase 1 default transport. It keeps all collaboration local
to the process while preserving the same CollaborationTransport trait
contract that a future A2A-backed transport would implement.
§Example
use adk_code::a2a_compat::{CollaborationTransport, LocalTransport};
use adk_code::{CollaborationEvent, CollaborationEventKind};
let transport = LocalTransport::new(128);
let mut rx = transport.subscribe();
transport.publish(CollaborationEvent::new(
"c1", "topic", "agent", CollaborationEventKind::WorkPublished,
)).await.unwrap();
let event = rx.recv().await.unwrap();
assert_eq!(event.correlation_id, "c1");Implementations§
Trait Implementations§
Source§impl CollaborationTransport for LocalTransport
impl CollaborationTransport for LocalTransport
Source§fn publish<'life0, 'async_trait>(
&'life0 self,
event: CollaborationEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: CollaborationEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish a collaboration event to all subscribers.
Source§fn subscribe(&self) -> Box<dyn CollaborationReceiver>
fn subscribe(&self) -> Box<dyn CollaborationReceiver>
Create a new receiver for collaboration events.
Source§impl Debug for LocalTransport
impl Debug for LocalTransport
Auto Trait Implementations§
impl Freeze for LocalTransport
impl RefUnwindSafe for LocalTransport
impl Send for LocalTransport
impl Sync for LocalTransport
impl Unpin for LocalTransport
impl UnsafeUnpin for LocalTransport
impl UnwindSafe for LocalTransport
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