pub trait SortAssertion<T>where
T: PartialOrd,{
// Required methods
fn should_be_sorted_ascending(&self) -> &Self;
fn should_be_sorted_descending(&self) -> &Self;
}Expand description
SortAssertion enables assertions about whether a collection’s elements are sorted in a specific order.
Required Methods§
Sourcefn should_be_sorted_ascending(&self) -> &Self
fn should_be_sorted_ascending(&self) -> &Self
- Asserts that the elements of the collection are in ascending order (non-decreasing, allowing duplicates).
- Returns a reference to self for fluent chaining.
- Panics if the assertion fails.
§Example
use clearcheck::assertions::collection::sort::SortAssertion;
let collection = vec![1, 2, 3, 3, 5];
collection.should_be_sorted_ascending();Sourcefn should_be_sorted_descending(&self) -> &Self
fn should_be_sorted_descending(&self) -> &Self
- Asserts that the elements of the collection are in descending order (non-increasing, allowing duplicates).
- Returns a reference to self for fluent chaining.
- Panics if the assertion fails.
§Example
use clearcheck::assertions::collection::sort::SortAssertion;
let collection = vec![5, 4, 3, 3, 2, 1];
collection.should_be_sorted_descending();Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".