Skip to main content

Poller

Struct Poller 

Source
pub struct Poller { /* private fields */ }
Expand description

拉模式输出句柄。

Implementations§

Source§

impl Poller

Source

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.

Source

pub fn next_event_timeout( &self, timeout: Duration, ) -> Result<Option<OutputEvent>>

Timed form of next_event.

Source

pub fn try_next_event(&self) -> Option<OutputEvent>

Non-blocking form of next_event.

Source

pub fn next(&self) -> Option<Packet>

取下一个包。等待期间会抽取并执行主线程任务。

Source

pub fn next_result(&self) -> Result<Option<Packet>>

Source

pub fn next_timeout(&self, timeout: Duration) -> Result<Option<Packet>>

带超时:Ok(Some) 取到,Ok(None) 图已结束,Err(Timeout) 超时。

Source

pub fn try_next(&self) -> Option<Packet>

非阻塞:仅看现有队列。

Source

pub fn try_next_result(&self) -> Result<Option<Packet>>

Source

pub fn is_closed(&self) -> bool

边是否已关闭 —— 即「不会再有入队」,不等于队列已排空。

单独用它判流结束会丢包:生产者可以在你读到 false 之后入队并关边。判流结束请用 next() / next_result() / try_next_result() 返回的 Ok(None)(它们已经包含了 最终排空),或者显式写成 is_closed() && is_empty() —— 顺序不能反,先观察到 closed 为真才能保证随后的 is_empty() 是权威的。

Source

pub fn is_empty(&self) -> bool

队列当前是否为空。不代表流结束 —— 见 is_closed。

Source

pub fn dropped_count(&self) -> u64

Source

pub fn backpressure_stats(&self) -> PollerBackpressureStatsSnapshot

Trait Implementations§

Source§

impl Debug for Poller

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Poller

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.