pub struct Poller { /* private fields */ }Expand description
拉模式输出句柄。
Implementations§
Source§impl Poller
impl Poller
Sourcepub fn next_event(&self) -> Option<OutputEvent>
pub fn next_event(&self) -> Option<OutputEvent>
Get the next output as a typed packet, timestamp-bound, or done event.
Use a poller created by Graph::add_poller_with_timestamp_bounds to receive all three
variants. A normal poller only yields OutputEvent::Packet and ends with None.
Sourcepub fn next_event_timeout(
&self,
timeout: Duration,
) -> Result<Option<OutputEvent>>
pub fn next_event_timeout( &self, timeout: Duration, ) -> Result<Option<OutputEvent>>
Timed form of next_event.
Sourcepub fn try_next_event(&self) -> Option<OutputEvent>
pub fn try_next_event(&self) -> Option<OutputEvent>
Non-blocking form of next_event.
pub fn next_result(&self) -> Result<Option<Packet>>
Sourcepub fn next_timeout(&self, timeout: Duration) -> Result<Option<Packet>>
pub fn next_timeout(&self, timeout: Duration) -> Result<Option<Packet>>
带超时:Ok(Some) 取到,Ok(None) 图已结束,Err(Timeout) 超时。
pub fn try_next_result(&self) -> Result<Option<Packet>>
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
边是否已关闭 —— 即「不会再有入队」,不等于队列已排空。
单独用它判流结束会丢包:生产者可以在你读到 false 之后入队并关边。判流结束请用
next() / next_result() / try_next_result() 返回的 Ok(None)(它们已经包含了
最终排空),或者显式写成 is_closed() && is_empty() —— 顺序不能反,先观察到 closed
为真才能保证随后的 is_empty() 是权威的。
pub fn dropped_count(&self) -> u64
pub fn backpressure_stats(&self) -> PollerBackpressureStatsSnapshot
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Poller
impl !UnwindSafe for Poller
impl Freeze for Poller
impl Send for Poller
impl Sync for Poller
impl Unpin for Poller
impl UnsafeUnpin for Poller
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