pub struct Breakdown { /* private fields */ }Expand description
A value-typed slice axis: a name plus a list of Buckets.
Breakdown is the kernel summarizer’s per-bucket slice descriptor.
The two pre-defined constructors Breakdown::coco_area_det and
Breakdown::coco_area_keypoints reproduce pycocotools’ default
area-grid layouts; user-defined Breakdowns are constructed via
Breakdown::new.
The axis name has no effect on numeric output today — labels on
individual buckets are what reach the summary table — but is kept
alongside the bucket list so a future schema-bump can surface it
(e.g., "breakdown_axis": "area" in the CLI’s JSON output, ADR-0015).
§Invariants (debug-checked at construction)
bucketsis non-empty.- Every
Bucket::indexis unique and lies in0..buckets.len().
These invariants let downstream consumers (Breakdown::area_ranges,
Breakdown::summary_areas, the orchestrator) treat the layout as a
dense, gap-free A-axis without re-validating.
Implementations§
Source§impl Breakdown
impl Breakdown
Sourcepub fn new(axis: impl Into<Cow<'static, str>>, buckets: Vec<Bucket>) -> Self
pub fn new(axis: impl Into<Cow<'static, str>>, buckets: Vec<Bucket>) -> Self
Construct a breakdown from an axis name and a list of buckets.
§Panics
In debug builds, panics if buckets is empty or has duplicate
or out-of-range indices. Release builds silently accept the
degenerate input — downstream slicing will produce empty / -1
sentinel cells but cannot violate memory safety
(#![forbid(unsafe_code)]).
Sourcepub fn coco_area_det() -> Self
pub fn coco_area_det() -> Self
The four-bucket COCO area grid for det-family kernels (bbox /
segm / boundary): all, small, medium, large with
inclusive [lo, hi] ranges [0, 1e10], [0, 32^2], [32^2, 96^2], [96^2, 1e10].
Indices line up with the legacy AreaRng constants: 0 = all, 1 = small, 2 = medium, 3 = large. The literal numbers
are pinned by quirk D4 (strict) and reproduce pycocotools’
Params.areaRng bit-for-bit.
Sourcepub fn coco_area_keypoints() -> Self
pub fn coco_area_keypoints() -> Self
The three-bucket keypoints area grid: all, medium, large.
Quirk D5 (strict, ratified by ADR-0012): pycocotools omits
the small bucket for iouType="keypoints". The A-axis is
compressed to three entries — 0 = all, 1 = medium, 2 = large — matching what the kp summarizer’s
StatRequest::coco_keypoints_default expects.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of buckets — the size of the A-axis the orchestrator
emits and the accumulator slices on.
Sourcepub fn bucket_at(&self, index: usize) -> Option<&Bucket>
pub fn bucket_at(&self, index: usize) -> Option<&Bucket>
Bucket at A-axis position index, or None if absent.
Sourcepub fn area_ranges(&self) -> Vec<AreaRange>
pub fn area_ranges(&self) -> Vec<AreaRange>
Materialize the AreaRange slice the per-image orchestrator
consumes via crate::EvaluateParams::area_ranges.
Cheap (buckets.len() allocations) and idempotent — call as
often as needed; cache the result in a local if profiling shows
it on a hot path.
Sourcepub fn summary_areas(&self) -> Vec<AreaRng>
pub fn summary_areas(&self) -> Vec<AreaRng>
Materialize the AreaRng slice the summarizer consumes when
rendering each per-bucket crate::summarize::StatLine. Useful for callers
that build custom StatRequest plans against this breakdown’s
A-axis layout.
Sourcepub fn detection_plan(&self) -> Option<[StatRequest; 12]>
pub fn detection_plan(&self) -> Option<[StatRequest; 12]>
Build the canonical 12-row pycocotools detection plan over this breakdown.
The breakdown must have the four-bucket layout (0, 1, 2, 3)
matching (all, small, medium, large); otherwise this method
returns None and the caller falls back to
StatRequest::coco_detection_default (which assumes the
canonical layout). For breakdowns with non-canonical bucket
counts (e.g., a 5-bucket fine-grained area split), callers
should compose their own plan via
StatRequest::new + Self::summary_areas.
Returning Option rather than Result keeps the surface lean:
the only failure mode is “this breakdown isn’t the canonical
detection shape”, which the caller resolves by composing a
custom plan, not by surfacing an error.
Sourcepub fn keypoints_plan(&self) -> Option<[StatRequest; 10]>
pub fn keypoints_plan(&self) -> Option<[StatRequest; 10]>
Build the canonical 10-row pycocotools keypoints plan over this breakdown.
Mirrors StatRequest::coco_keypoints_default but pulls the
(all, medium, large) labels from this breakdown’s buckets at
indices 0/1/2 — useful when a future caller wants the kp plan
shape but with custom labels (e.g., dataset-specific
“small-medium / medium / large” wording).
Returns None unless the breakdown has exactly three buckets
at indices 0/1/2.
Trait Implementations§
impl StructuralPartialEq for Breakdown
Auto Trait Implementations§
impl Freeze for Breakdown
impl RefUnwindSafe for Breakdown
impl Send for Breakdown
impl Sync for Breakdown
impl Unpin for Breakdown
impl UnsafeUnpin for Breakdown
impl UnwindSafe for Breakdown
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.