pub struct AttentionPolicy { /* private fields */ }Expand description
What an integrator asked to be told about, and how insistently.
Implementations§
Source§impl AttentionPolicy
impl AttentionPolicy
Sourcepub fn new(
kinds: impl IntoIterator<Item = AttentionKind>,
coalesce_window: DurationMs,
max_queued: QueueLimit,
overflow: AttentionOverflowPolicy,
inactivity_after: Option<DurationMs>,
limits: LoopLimits,
) -> Result<Self, DomainError>
pub fn new( kinds: impl IntoIterator<Item = AttentionKind>, coalesce_window: DurationMs, max_queued: QueueLimit, overflow: AttentionOverflowPolicy, inactivity_after: Option<DurationMs>, limits: LoopLimits, ) -> Result<Self, DomainError>
Construct a validated policy.
An empty selection is refused rather than silently meaning “everything”: a binding that asked for nothing and is woken for everything is the kind of surprise a policy exists to prevent.
Sourcepub fn admits(&self, kind: AttentionKind) -> bool
pub fn admits(&self, kind: AttentionKind) -> bool
Whether this policy asked to hear about that kind.
pub const fn kinds(&self) -> &BTreeSet<AttentionKind>
Sourcepub const fn coalesce_window(&self) -> DurationMs
pub const fn coalesce_window(&self) -> DurationMs
How long two restless events of one kind are folded into one.
Sourcepub const fn coalesces(kind: AttentionKind) -> bool
pub const fn coalesces(kind: AttentionKind) -> bool
Whether this kind is one the window applies to at all.
Coalescing a result or a decision would lose one; only the kinds that repeat while nothing changes are folded.
pub const fn max_queued(&self) -> QueueLimit
pub const fn overflow(&self) -> AttentionOverflowPolicy
Sourcepub const fn inactivity_after(&self) -> Option<DurationMs>
pub const fn inactivity_after(&self) -> Option<DurationMs>
How long nothing may happen before the quiet is itself reported.
pub const fn limits(&self) -> LoopLimits
Trait Implementations§
Source§impl Clone for AttentionPolicy
impl Clone for AttentionPolicy
Source§impl Debug for AttentionPolicy
impl Debug for AttentionPolicy
Source§impl Default for AttentionPolicy
impl Default for AttentionPolicy
Source§impl<'de> Deserialize<'de> for AttentionPolicy
impl<'de> Deserialize<'de> for AttentionPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for AttentionPolicy
Source§impl PartialEq for AttentionPolicy
impl PartialEq for AttentionPolicy
Source§impl Serialize for AttentionPolicy
impl Serialize for AttentionPolicy
impl StructuralPartialEq for AttentionPolicy
Auto Trait Implementations§
impl Freeze for AttentionPolicy
impl RefUnwindSafe for AttentionPolicy
impl Send for AttentionPolicy
impl Sync for AttentionPolicy
impl Unpin for AttentionPolicy
impl UnsafeUnpin for AttentionPolicy
impl UnwindSafe for AttentionPolicy
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