macro_rules! transform_many_safe_async_methods {
() => {
fn transform_many_safe_async<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
Fut: std::future::Future<Output = Result<Vec<D>, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_with(move |item: T, _key: K| many_selector(item), key_selector, error_handler, None, None)
}
fn transform_many_safe_async_with_key<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
Fut: std::future::Future<Output = Result<Vec<D>, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_with(many_selector, key_selector, error_handler, None, None)
}
fn transform_many_safe_async_with<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
Fut: std::future::Future<Output = Result<Vec<D>, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
equality_comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> bool>>,
comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> std::cmp::Ordering>>,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
crate::cache::internal::transform_many_async(
self.change_sets(),
crate::cache::internal::enumerable_change_set_transformer(many_selector, key_selector),
equality_comparer.unwrap_or_else(crate::cache::internal::default_equality_comparer),
comparer,
Some(std::rc::Rc::new(error_handler)),
)
}
fn transform_many_safe_async_observable_collection<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::binding::ObservableCollectionEx<D> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_observable_collection_with(move |item: T, _key: K| many_selector(item), key_selector, error_handler, None, None)
}
fn transform_many_safe_async_observable_collection_with_key<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::binding::ObservableCollectionEx<D> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_observable_collection_with(many_selector, key_selector, error_handler, None, None)
}
fn transform_many_safe_async_observable_collection_with<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::binding::ObservableCollectionEx<D> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
key_selector: impl Fn(&D) -> DK + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
equality_comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> bool>>,
comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> std::cmp::Ordering>>,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
crate::cache::internal::transform_many_async(
self.change_sets(),
crate::cache::internal::observable_collection_change_set_transformer(many_selector, key_selector),
equality_comparer.unwrap_or_else(crate::cache::internal::default_equality_comparer),
comparer,
Some(std::rc::Rc::new(error_handler)),
)
}
fn transform_many_safe_async_observable_cache<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::cache::IObservableCache<D, DK> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T) -> Fut + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_observable_cache_with(move |item: T, _key: K| many_selector(item), error_handler, None, None)
}
fn transform_many_safe_async_observable_cache_with_key<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::cache::IObservableCache<D, DK> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
self.transform_many_safe_async_observable_cache_with(many_selector, error_handler, None, None)
}
fn transform_many_safe_async_observable_cache_with<
D: Clone + PartialEq + 'static,
DK: Eq + std::hash::Hash + Clone + 'static,
C: crate::cache::IObservableCache<D, DK> + 'static,
Fut: std::future::Future<Output = Result<C, ferroui_system::ObservableError>> + 'static,
>(
&self,
many_selector: impl Fn(T, K) -> Fut + 'static,
error_handler: impl Fn(crate::kernel::Error<T, K>) + 'static,
equality_comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> bool>>,
comparer: Option<std::rc::Rc<dyn Fn(&D, &D) -> std::cmp::Ordering>>,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<D, DK>>> {
crate::cache::internal::transform_many_async(
self.change_sets(),
crate::cache::internal::observable_cache_change_set_transformer(many_selector),
equality_comparer.unwrap_or_else(crate::cache::internal::default_equality_comparer),
comparer,
Some(std::rc::Rc::new(error_handler)),
)
}
};
}
pub(crate) use transform_many_safe_async_methods;