Skip to main content

ferroui_dynamic_data/cache/
transform_async_options.rs

1//! `TransformAsyncOptions` (`Cache/TransformAsyncOptions.cs`).
2
3/// The options of `TransformAsync` and `TransformSafeAsync` (`record struct
4/// TransformAsyncOptions(int? MaximumConcurrency, bool TransformOnRefresh)`).
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
6pub struct TransformAsyncOptions {
7    /// The greatest number of transforms in flight at once; `None` for no limit
8    /// (`MaximumConcurrency`).
9    pub maximum_concurrency: Option<usize>,
10    /// Whether a refresh transforms the item again (`TransformOnRefresh`).
11    pub transform_on_refresh: bool,
12}
13
14impl TransformAsyncOptions {
15    /// No limit of concurrency, and a refresh is forwarded without a new transform (`Default`).
16    pub const DEFAULT: TransformAsyncOptions = TransformAsyncOptions { maximum_concurrency: None, transform_on_refresh: false };
17
18    /// The options of `maximum_concurrency` and `transform_on_refresh`
19    /// (`TransformAsyncOptions(int?, bool)`).
20    pub const fn new(maximum_concurrency: Option<usize>, transform_on_refresh: bool) -> Self {
21        Self { maximum_concurrency, transform_on_refresh }
22    }
23}