pub struct EventCollector { /* private fields */ }
👎Deprecated: prefer the stand-alone collect() function to collect arbitrary events
Expand description
A EventCollector
receives Event
’s match the given filters for a set duration.
Implementations§
Source§impl EventCollector
impl EventCollector
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(&Event) -> bool + Send + Sync + 'static,
) -> Self
pub fn filter( self, filter: impl Fn(&Event) -> bool + Send + Sync + 'static, ) -> Self
Sets a generic filter function.
Sourcepub fn build(self) -> impl Stream<Item = Event>
👎Deprecated: use .stream()
instead
pub fn build(self) -> impl Stream<Item = Event>
.stream()
insteadDeprecated, use Self::stream()
instead.
Trait Implementations§
Source§impl IntoFuture for EventCollector
impl IntoFuture for EventCollector
Source§type IntoFuture = Pin<Box<dyn Future<Output = <EventCollector as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <EventCollector 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 EventCollector
impl !RefUnwindSafe for EventCollector
impl Send for EventCollector
impl Sync for EventCollector
impl Unpin for EventCollector
impl !UnwindSafe for EventCollector
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