Skip to main content

DegradationCascade

Struct DegradationCascade 

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

Degradation cascade orchestrator.

Sits between the conformal frame guard and the render budget system. Call [pre_render] before each frame and [post_render] after.

Implementations§

Source§

impl DegradationCascade

Source

pub fn new(config: CascadeConfig) -> Self

Create a new cascade with the given configuration.

Source

pub fn with_defaults() -> Self

Create a cascade with default configuration.

Source

pub fn pre_render(&mut self, budget_us: f64, key: BucketKey) -> PreRenderResult

Pre-render check: predict p99 and decide whether to degrade.

Returns the degradation level to use for this frame and the prediction. The caller should apply the returned level to the render budget.

Source

pub fn post_render(&mut self, frame_time_us: f64, key: BucketKey)

Post-render observation: feed actual frame time to the guard.

Call this after the frame has been rendered with the measured time.

Source

pub fn level(&self) -> DegradationLevel

Get the current degradation level.

Source

pub fn recovery_streak(&self) -> u32

Get the current recovery streak.

Source

pub fn frame_idx(&self) -> u64

Get the frame counter.

Source

pub fn total_degrades(&self) -> u64

Total degrade events.

Source

pub fn total_recoveries(&self) -> u64

Total recovery events.

Source

pub fn last_evidence(&self) -> Option<&CascadeEvidence>

Access the last cascade evidence.

Source

pub fn guard(&self) -> &ConformalFrameGuard

Access the underlying guard.

Source

pub fn config(&self) -> &CascadeConfig

Access the configuration.

Source

pub fn reset(&mut self)

Reset the cascade to initial state.

Source

pub fn should_render_widget(&self, is_essential: bool) -> bool

Whether widget should render given current degradation level and essentiality.

At EssentialOnly or higher degradation, non-essential widgets are skipped.

Source

pub fn telemetry(&self) -> CascadeTelemetry

Capture telemetry for the cascade.

Trait Implementations§

Source§

impl Debug for DegradationCascade

Source§

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

Formats the value using the given formatter. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more