Skip to main content

ferroui_dynamic_data/cache/
sort_and_page_options.rs

1//! `SortAndPageOptions` and `SortAndVirtualizeOptions` (`Cache/SortAndPageOptions.cs`,
2//! `Cache/SortAndVirtualizeOptions.cs`).
3
4/// The options of `SortAndPage` (`SortAndPageOptions`).
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
6pub struct SortAndPageOptions {
7    /// The number of changes from which the sorted items are rebuilt rather than edited; 0 never
8    /// rebuilds (`ResetThreshold`, by default `BindingOptions.DefaultResetThreshold`, 25).
9    pub reset_threshold: usize,
10    /// Find positions with a binary search, which needs the values that the comparer reads never
11    /// to change (`UseBinarySearch`).
12    pub use_binary_search: bool,
13    /// The initial capacity of the sorted list (`InitialCapacity`).
14    pub initial_capacity: usize,
15}
16
17impl Default for SortAndPageOptions {
18    fn default() -> Self {
19        Self { reset_threshold: 25, use_binary_search: false, initial_capacity: 0 }
20    }
21}
22
23/// The options of `SortAndVirtualize` (`SortAndVirtualizeOptions`).
24#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
25pub struct SortAndVirtualizeOptions {
26    /// The number of changes from which the sorted items are rebuilt rather than edited; 0 never
27    /// rebuilds (`ResetThreshold`, by default `BindingOptions.DefaultResetThreshold`, 25).
28    pub reset_threshold: usize,
29    /// Find positions with a binary search, which needs the values that the comparer reads never
30    /// to change (`UseBinarySearch`).
31    pub use_binary_search: bool,
32    /// The initial capacity of the sorted list (`InitialCapacity`).
33    pub initial_capacity: usize,
34}
35
36impl Default for SortAndVirtualizeOptions {
37    fn default() -> Self {
38        Self { reset_threshold: 25, use_binary_search: false, initial_capacity: 0 }
39    }
40}