pub enum BackpressurePolicy {
DropOldest,
DegradeQuality,
PauseUpstream,
Fail,
}Expand description
The four strategies the runtime knows how to execute when a
producer outruns its consumer. See also [crate::stream_runtime]
for the runtime impls.
Variants§
DropOldest
Drop the oldest item to make room for a fresh one. Used for “keep only the most recent” telemetry streams.
DegradeQuality
Apply a pure degradation function (e.g. resample audio to a
lower bitrate) so the downstream consumer still gets every
frame, just lossy. The degrader is declared via
degrade_quality(resample_to=8000) syntax.
PauseUpstream
Block the producer until the buffer drains. Safe for request/response flows but MUST NOT be used on real-time ingest paths (microphones, market data) or the source hangs.
Fail
Raise an error and cancel the stream. Forces callers to deal
with saturation as an explicit failure mode. The default-is-
no-default: a Stream<T> without a declared policy never
falls back to Fail; it fails to compile.
Implementations§
Trait Implementations§
Source§impl Clone for BackpressurePolicy
impl Clone for BackpressurePolicy
Source§fn clone(&self) -> BackpressurePolicy
fn clone(&self) -> BackpressurePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BackpressurePolicy
Source§impl Debug for BackpressurePolicy
impl Debug for BackpressurePolicy
Source§impl Display for BackpressurePolicy
impl Display for BackpressurePolicy
impl Eq for BackpressurePolicy
Source§impl Hash for BackpressurePolicy
impl Hash for BackpressurePolicy
Source§impl PartialEq for BackpressurePolicy
impl PartialEq for BackpressurePolicy
Source§fn eq(&self, other: &BackpressurePolicy) -> bool
fn eq(&self, other: &BackpressurePolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BackpressurePolicy
Auto Trait Implementations§
impl Freeze for BackpressurePolicy
impl RefUnwindSafe for BackpressurePolicy
impl Send for BackpressurePolicy
impl Sync for BackpressurePolicy
impl Unpin for BackpressurePolicy
impl UnsafeUnpin for BackpressurePolicy
impl UnwindSafe for BackpressurePolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more