Skip to main content

ProfileCollector

Struct ProfileCollector 

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

No-allocation collector for one logical 1–10 step heater-profile scan.

Call Self::ingest_batch after every hardware poll. In parallel mode, invalid intermediate/dummy conversions are held as a pending value; the gas-valid conversion wins, or the last invalid conversion is retained when the gas index advances or Self::finish is called. A gas-index rollover freezes the collector so fields from two scans can never be mixed.

Implementations§

Source§

impl ProfileCollector

Source

pub const fn new( mode: OperationMode, expected_steps: u8, ) -> Result<Self, ProfileCollectorError>

Construct an empty collector for one sequential or parallel profile.

§Errors

Returns an error for a zero/over-length profile or a non-profile mode.

Source

pub fn ingest_batch(&mut self, fields: &Measurements, observed_offset_us: u32)

Feed all newly available fields from one hardware read, oldest first.

All fields in the batch receive the same host-observed read offset. Call Self::ingest individually if the application has finer timing.

Source

pub fn ingest(&mut self, measurement: Measurement, observed_offset_us: u32)

Feed one newly read field into the collector.

Source

pub fn finish(&mut self, reason: ProfileFinishReason)

Finalize a bounded polling attempt and retain a last invalid parallel conversion when no gas-valid conversion arrived before the deadline.

Source

pub const fn expected_steps(&self) -> u8

Configured number of profile steps.

Source

pub const fn observed_steps(&self) -> u32

Number of heater steps for which a terminal field was retained.

Source

pub const fn steps(&self) -> &[Option<ProfileStep>; 10]

Fixed-capacity slots indexed by heater/gas index.

Source

pub fn step(&self, gas_index: u8) -> Option<&ProfileStep>

Return one retained step by gas index.

Source

pub const fn observed_mask(&self) -> u16

Bitmap of expected heater steps for which a terminal field was kept.

Source

pub const fn gas_valid_mask(&self) -> u16

Bitmap of retained steps with the gas-valid bit set.

Source

pub const fn heater_stable_mask(&self) -> u16

Bitmap of retained steps with the heater-stable bit set.

Source

pub const fn duplicate_mask(&self) -> u16

Bitmap of valid gas indexes for which a duplicate field was seen.

Source

pub const fn observed_field_count(&self) -> u16

Saturating count of every new-status field supplied to the collector.

This includes duplicates, invalid indexes, out-of-order fields, and fields ignored after collection froze, making polling behavior fully observable even when a field is not retained as a profile step.

Source

pub const fn observed_field_count_overflowed(&self) -> bool

Whether Self::observed_field_count saturated at u16::MAX.

Source

pub const fn missing_mask(&self) -> u16

Bitmap of expected steps for which no terminal field was retained.

Source

pub const fn gas_invalid_mask(&self) -> u16

Bitmap of observed steps that did not have valid gas data.

Source

pub const fn is_structurally_complete(&self) -> bool

Whether every configured step has a retained terminal field.

Source

pub const fn all_steps_gas_valid(&self) -> bool

Whether every configured step has yielded a gas-valid conversion.

This is the safe condition for explicitly stopping a repeating parallel scan without confusing dummy fields with completed steps.

Source

pub const fn all_steps_heater_stable(&self) -> bool

Whether all retained profile steps report heater stability.

Source

pub const fn is_frozen(&self) -> bool

Whether this collector stopped accepting fields after a profile wrap or an explicit Self::finish call.

Source

pub const fn finish_reason(&self) -> Option<ProfileFinishReason>

Why this profile stopped accepting measurements, if it has finished.

Source

pub const fn counters(&self) -> &ProfileCounters

Loss, duplicate, rollover, and invalid-index accounting.

Trait Implementations§

Source§

impl Clone for ProfileCollector

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProfileCollector

Source§

impl Debug for ProfileCollector

Source§

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

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

impl Eq for ProfileCollector

Source§

impl Format for ProfileCollector

Available on crate feature defmt only.
Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for ProfileCollector

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProfileCollector

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.