Skip to main content

SelectionReportAssertionChain

Struct SelectionReportAssertionChain 

Source
pub struct SelectionReportAssertionChain<'a> { /* private fields */ }
Expand description

A fluent assertion chain for inspecting a SelectionReport.

Obtain an instance via SelectionReportAssertions::should(). Assertion methods are chained on this struct and each return &mut Self so multiple checks can be composed in a single expression.

Implementations§

Source§

impl<'a> SelectionReportAssertionChain<'a>

Source

pub fn include_item_with_kind(&mut self, kind: ContextKind) -> &mut Self

Asserts that at least one included item has the given kind.

Source

pub fn include_item_matching( &mut self, predicate: impl Fn(&IncludedItem) -> bool, ) -> &mut Self

Asserts that at least one included item satisfies predicate.

Source

pub fn include_exact_n_items_with_kind( &mut self, kind: ContextKind, n: usize, ) -> &mut Self

Asserts that exactly n included items have the given kind.

Source

pub fn exclude_item_with_reason(&mut self, reason: ExclusionReason) -> &mut Self

Asserts that at least one excluded item carries the given reason variant.

Source

pub fn exclude_item_matching_with_reason( &mut self, predicate: impl Fn(&ExcludedItem) -> bool, reason: ExclusionReason, ) -> &mut Self

Asserts that at least one excluded item satisfies predicate and has the given reason variant.

Source

pub fn have_excluded_item_with_budget_details( &mut self, predicate: impl Fn(&ExcludedItem) -> bool, expected_item_tokens: i64, expected_available_tokens: i64, ) -> &mut Self

Asserts that an excluded item matching predicate was excluded due to BudgetExceeded with exactly the given expected_item_tokens and expected_available_tokens.

Source

pub fn have_no_exclusions_for_kind(&mut self, kind: ContextKind) -> &mut Self

Asserts that no excluded item has the given kind.

Source

pub fn have_at_least_n_exclusions(&mut self, n: usize) -> &mut Self

Asserts that the excluded list has at least n items.

Source

pub fn excluded_items_are_sorted_by_score_descending(&mut self) -> &mut Self

Asserts that the excluded list is sorted in non-increasing score order.

Source

pub fn have_budget_utilization_above( &mut self, threshold: f64, budget: &ContextBudget, ) -> &mut Self

Asserts that sum(included tokens) / budget.max_tokens() >= threshold.

Source

pub fn have_kind_coverage_count(&mut self, n: usize) -> &mut Self

Asserts that the included list contains at least n distinct ContextKind values.

Source

pub fn place_item_at_edge( &mut self, predicate: impl Fn(&IncludedItem) -> bool, ) -> &mut Self

Asserts that an included item matching predicate is at position 0 or position count−1.

Source

pub fn place_top_n_scored_at_edges(&mut self, n: usize) -> &mut Self

Asserts that the top-n scored included items occupy the n outermost edge positions.

Edge position mapping: 0, count−1, 1, count−2, … (alternating inward from both ends). n = 0 always passes. n > included.len() panics with a count mismatch message. Uses index-based approach — no HashSet<&IncludedItem> (f64 prevents Hash).

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, 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.