pub struct MessageCollector { /* private fields */ }
Expand description
A MessageCollector
receives Message
’s match the given filters for a set duration.
Implementations§
Source§impl MessageCollector
impl MessageCollector
Sourcepub fn new(shard: impl AsRef<ShardMessenger>) -> Self
pub fn new(shard: impl AsRef<ShardMessenger>) -> Self
Creates a new collector without any filters configured.
Sourcepub fn timeout(self, duration: Duration) -> Self
pub fn timeout(self, duration: Duration) -> Self
Sets a duration for how long the collector shall receive interactions.
Sourcepub fn filter(
self,
filter: impl Fn(&Message) -> bool + Send + Sync + 'static,
) -> Self
pub fn filter( self, filter: impl Fn(&Message) -> bool + Send + Sync + 'static, ) -> Self
Sets a generic filter function.
Sourcepub fn channel_id(self, channel_id: ChannelId) -> Self
pub fn channel_id(self, channel_id: ChannelId) -> Self
Sourcepub fn build(self) -> impl Stream<Item = Message>
👎Deprecated: use .stream()
instead
pub fn build(self) -> impl Stream<Item = Message>
.stream()
insteadDeprecated, use Self::stream()
instead.
Trait Implementations§
Source§impl IntoFuture for MessageCollector
impl IntoFuture for MessageCollector
Source§type IntoFuture = Pin<Box<dyn Future<Output = <MessageCollector as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <MessageCollector as IntoFuture>::Output> + Send>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl Freeze for MessageCollector
impl !RefUnwindSafe for MessageCollector
impl Send for MessageCollector
impl Sync for MessageCollector
impl Unpin for MessageCollector
impl !UnwindSafe for MessageCollector
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