pub struct BpfMapProjector<'a> { /* private fields */ }Expand description
Auto-projector handle returned by SampleSeries::bpf_map.
Lazily resolves the named map’s value at the requested entry
index when Self::field is invoked.
Implementations§
Source§impl<'a> BpfMapProjector<'a>
impl<'a> BpfMapProjector<'a>
Sourcepub fn at(self, index: usize) -> Self
pub fn at(self, index: usize) -> Self
Pin the entry index for the projection. Defaults to 0
(typical for ARRAY / .bss / .data / .rodata maps,
which carry a single value at index 0). Use this to walk
into a HASH map at a specific ordinal.
Sourcepub fn field_u64(&self, field: &str) -> SeriesField<u64>
pub fn field_u64(&self, field: &str) -> SeriesField<u64>
Project a single named struct field as u64 (the most
common temporal-assertion shape — counters, byte counts).
The label routed onto the resulting SeriesField is the
caller-supplied field name; combined with the map name in
the diagnostic the failure message reads
"<map>.<entry_index>.<field>".
Sourcepub fn field_i64(&self, field: &str) -> SeriesField<i64>
pub fn field_i64(&self, field: &str) -> SeriesField<i64>
Project a single named struct field as i64.
Sourcepub fn field_f64(&self, field: &str) -> SeriesField<f64>
pub fn field_f64(&self, field: &str) -> SeriesField<f64>
Project a single named struct field as f64.
Sourcepub fn member_names(&self) -> Vec<String>
pub fn member_names(&self) -> Vec<String>
Discover the struct member names of the map’s rendered value, unioned across ALL samples (first-seen order, deduplicated). Useful for tests that want to enumerate every scalar field for a blanket assertion.
Discovery spans every row rather than rows.first() alone: sample
0 can be a placeholder (the map missing or not yet captured) while
later rows carry the struct, and reading only row 0 would silently
enumerate nothing — blinding a “assert over every scalar field”
projection. Empty ONLY when NO sample renders the map as a struct
(the field set is genuinely undiscoverable).
Sourcepub fn u64_fields(&self) -> Vec<(String, SeriesField<u64>)>
pub fn u64_fields(&self) -> Vec<(String, SeriesField<u64>)>
Project every struct member that resolves as u64 for at
least one sample. Iterates Self::member_names, calls
Self::field_u64 for each, and keeps the entries whose
resulting SeriesField has at least one Ok value —
non-numeric members (strings, nested structs, floats) drop
out because their as_u64() cast always errors.
Sourcepub fn f64_fields(&self) -> Vec<(String, SeriesField<f64>)>
pub fn f64_fields(&self) -> Vec<(String, SeriesField<f64>)>
Project every struct member that resolves as f64 for at
least one sample. Mirrors Self::u64_fields using
Self::field_f64.
Sourcepub fn field_cpu_sum_u64(&self, field: &str) -> SeriesField<u64>
pub fn field_cpu_sum_u64(&self, field: &str) -> SeriesField<u64>
Sum a named per-CPU field across all CPUs as u64.
Err(NoMatch) when every slot is None (unreadable, not a real
zero); a readable all-zero map sums to Ok(0). Delegates to
SnapshotEntry::cpu_sum_u64.
Sourcepub fn field_cpu_sum_i64(&self, field: &str) -> SeriesField<i64>
pub fn field_cpu_sum_i64(&self, field: &str) -> SeriesField<i64>
Sum a named per-CPU field across all CPUs as i64. The sum
saturates at i64::MIN / i64::MAX (parity with the u64
variant’s saturating_add). Err(NoMatch) when every slot is
None (unreadable, not a real zero); a readable all-zero map
sums to Ok(0). Delegates to
SnapshotEntry::cpu_sum_i64.
Sourcepub fn field_cpu_sum_f64(&self, field: &str) -> SeriesField<f64>
pub fn field_cpu_sum_f64(&self, field: &str) -> SeriesField<f64>
Sum a named per-CPU field across all CPUs as f64.
Err(NoMatch) when every slot is None (unreadable, not a real
zero); a readable all-zero map sums to Ok(0.0). Delegates to
SnapshotEntry::cpu_sum_f64.
Sourcepub fn field_cpu_max_u64(&self, field: &str) -> SeriesField<u64>
pub fn field_cpu_max_u64(&self, field: &str) -> SeriesField<u64>
Maximum of a named per-CPU field across all CPUs as u64.
Err(NoMatch) when no CPU slot contributed. Delegates to
SnapshotEntry::cpu_max_u64.
Sourcepub fn field_cpu_max_i64(&self, field: &str) -> SeriesField<i64>
pub fn field_cpu_max_i64(&self, field: &str) -> SeriesField<i64>
Maximum of a named per-CPU field across all CPUs as i64.
Err(NoMatch) when no CPU slot contributed. Delegates to
SnapshotEntry::cpu_max_i64.
Sourcepub fn field_cpu_max_f64(&self, field: &str) -> SeriesField<f64>
pub fn field_cpu_max_f64(&self, field: &str) -> SeriesField<f64>
Maximum of a named per-CPU field across all CPUs as f64.
Err(NoMatch) when no CPU slot contributed; an all-NaN run
yields Ok(NaN). Delegates to
SnapshotEntry::cpu_max_f64.
Sourcepub fn field_cpu_min_u64(&self, field: &str) -> SeriesField<u64>
pub fn field_cpu_min_u64(&self, field: &str) -> SeriesField<u64>
Minimum of a named per-CPU field across all CPUs as u64.
Err(NoMatch) when no CPU slot contributed. Delegates to
SnapshotEntry::cpu_min_u64.
Sourcepub fn field_cpu_min_i64(&self, field: &str) -> SeriesField<i64>
pub fn field_cpu_min_i64(&self, field: &str) -> SeriesField<i64>
Minimum of a named per-CPU field across all CPUs as i64.
Err(NoMatch) when no CPU slot contributed. Delegates to
SnapshotEntry::cpu_min_i64.
Sourcepub fn field_cpu_min_f64(&self, field: &str) -> SeriesField<f64>
pub fn field_cpu_min_f64(&self, field: &str) -> SeriesField<f64>
Minimum of a named per-CPU field across all CPUs as f64.
Err(NoMatch) when no CPU slot contributed; an all-NaN run
yields Ok(NaN). Delegates to
SnapshotEntry::cpu_min_f64.
Sourcepub fn cpu(self, n: usize) -> BpfMapCpuProjector<'a>
pub fn cpu(self, n: usize) -> BpfMapCpuProjector<'a>
Narrow to a single CPU’s slot of a per-CPU map, returning a
BpfMapCpuProjector whose field_* read CPU n (vs the
cross-CPU Self::field_cpu_sum_u64 reductions). Mirrors
Self::at as a builder step; making the per-CPU SELECT a
distinct handle means .cpu(n).field_cpu_sum_* cannot be
written (aggregate-vs-select can’t be mixed up).
On a non-per-CPU map (.bss / ARRAY / HASH) .cpu(n) is a
no-op — the underlying SnapshotMap::cpu
narrow is recorded but ignored, so the value reads the same as
without it (it neither errors nor filters).
Auto Trait Implementations§
impl<'a> Freeze for BpfMapProjector<'a>
impl<'a> RefUnwindSafe for BpfMapProjector<'a>
impl<'a> Send for BpfMapProjector<'a>
impl<'a> Sync for BpfMapProjector<'a>
impl<'a> Unpin for BpfMapProjector<'a>
impl<'a> UnwindSafe for BpfMapProjector<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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