pub struct FakeChannel { /* private fields */ }Expand description
A Channel for tests: events are injected by the test, sent messages
are recorded.
Implementations§
Source§impl FakeChannel
impl FakeChannel
Sourcepub fn new(id: &str, caps: ChannelCaps) -> Self
pub fn new(id: &str, caps: ChannelCaps) -> Self
A channel id (fake:test) with caps.
Sourcepub async fn inject(&self, event: InboundEvent)
pub async fn inject(&self, event: InboundEvent)
Waits until the runtime started this channel, then delivers event.
Sourcepub fn sent_texts(&self) -> Vec<String>
pub fn sent_texts(&self) -> Vec<String>
Texts sent so far, oldest first.
Sourcepub fn sent(&self) -> Vec<(ReplyTarget, String)>
pub fn sent(&self) -> Vec<(ReplyTarget, String)>
Messages sent so far with their targets.
Sourcepub fn typing_count(&self) -> usize
pub fn typing_count(&self) -> usize
Typing indicators shown so far.
Trait Implementations§
Source§impl Channel for FakeChannel
impl Channel for FakeChannel
Source§fn caps(&self) -> &ChannelCaps
fn caps(&self) -> &ChannelCaps
What the platform supports.
Source§fn run<'life0, 'async_trait>(
&'life0 self,
sink: Arc<dyn InboundSink>,
shutdown: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
sink: Arc<dyn InboundSink>,
shutdown: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn send<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
to: &'life1 ReplyTarget,
message: &'life2 RenderedMessage,
) -> Pin<Box<dyn Future<Output = Result<SentRef, ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
to: &'life1 ReplyTarget,
message: &'life2 RenderedMessage,
) -> Pin<Box<dyn Future<Output = Result<SentRef, ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sends one message.
Source§fn typing<'life0, 'life1, 'async_trait>(
&'life0 self,
_to: &'life1 ReplyTarget,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn typing<'life0, 'life1, 'async_trait>(
&'life0 self,
_to: &'life1 ReplyTarget,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Shows a typing indicator once. The runtime repeats it while an agent works.
Source§fn edit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sent: &'life1 SentRef,
message: &'life2 RenderedMessage,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn edit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sent: &'life1 SentRef,
message: &'life2 RenderedMessage,
) -> Pin<Box<dyn Future<Output = Result<(), ChannelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Replaces the text of a sent message. Only called when
ChannelCaps::edit is true.Auto Trait Implementations§
impl !Freeze for FakeChannel
impl RefUnwindSafe for FakeChannel
impl Send for FakeChannel
impl Sync for FakeChannel
impl Unpin for FakeChannel
impl UnsafeUnpin for FakeChannel
impl UnwindSafe for FakeChannel
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