macro_rules! bind_methods {
() => {
fn bind<C: crate::binding::IObservableCollection<T> + Clone + 'static>(
&self,
destination: &C,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>
where
T: PartialEq,
Self: Sized + 'static,
{
crate::cache::internal::bind::bind_with_options(self, self.change_sets(), std::rc::Rc::new(destination.clone()), crate::DynamicDataOptions::binding())
}
fn bind_with_threshold<C: crate::binding::IObservableCollection<T> + Clone + 'static>(
&self,
destination: &C,
refresh_threshold: usize,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>
where
T: PartialEq,
{
let defaults = crate::DynamicDataOptions::binding();
let options = if refresh_threshold == crate::binding::BindingOptions::DEFAULT_RESET_THRESHOLD { defaults } else { defaults.with_reset_threshold(refresh_threshold) };
crate::cache::internal::bind::bind_with_adaptor(
self.change_sets(),
std::rc::Rc::new(destination.clone()),
std::rc::Rc::new(crate::binding::ObservableCollectionAdaptor::<T, K>::with_options(options)),
)
}
fn bind_with_options<C: crate::binding::IObservableCollection<T> + Clone + 'static>(
&self,
destination: &C,
options: crate::binding::BindingOptions,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>
where
T: PartialEq,
Self: Sized + 'static,
{
crate::cache::internal::bind::bind_with_options(self, self.change_sets(), std::rc::Rc::new(destination.clone()), options)
}
fn bind_with_adaptor<C: crate::binding::IObservableCollection<T> + Clone + 'static>(
&self,
destination: &C,
updater: std::rc::Rc<dyn crate::binding::IObservableCollectionAdaptor<T, K>>,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>
where
T: PartialEq,
{
crate::cache::internal::bind::bind_with_adaptor(self.change_sets(), std::rc::Rc::new(destination.clone()), updater)
}
fn bind_with_sorted_adaptor<C: crate::binding::IObservableCollection<T> + Clone + 'static>(
&self,
destination: &C,
updater: std::rc::Rc<dyn crate::binding::ISortedObservableCollectionAdaptor<T, K>>,
) -> std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>
where
T: PartialEq,
Self: Sized + 'static,
{
crate::cache::internal::bind::bind_sorted_with_adaptor(crate::cache::internal::bind::expect_sorted_stream(self), std::rc::Rc::new(destination.clone()), updater)
}
fn bind_read_only(
&self,
) -> (std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>, crate::binding::ReadOnlyObservableCollection<T>)
where
T: PartialEq,
Self: Sized + 'static,
{
let (target, read_only) = crate::cache::internal::bind::new_read_only_target::<T>(None);
if let Some(bound) = crate::cache::internal::bind::bind_context_stream(self, target, None) {
return (bound, read_only);
}
self.bind_read_only_with(crate::binding::BindingOptions::DEFAULT_RESET_THRESHOLD, crate::binding::BindingOptions::DEFAULT_USE_REPLACE_FOR_UPDATES)
}
fn bind_read_only_with(
&self,
reset_threshold: usize,
use_replace_for_updates: bool,
) -> (std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>, crate::binding::ReadOnlyObservableCollection<T>)
where
T: PartialEq,
Self: Sized + 'static,
{
self.bind_read_only_with_options(crate::cache::internal::bind::binding_options(reset_threshold, use_replace_for_updates))
}
fn bind_read_only_with_options(
&self,
options: crate::binding::BindingOptions,
) -> (std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>, crate::binding::ReadOnlyObservableCollection<T>)
where
T: PartialEq,
Self: Sized + 'static,
{
let (target, read_only) = crate::cache::internal::bind::new_read_only_target::<T>(None);
(crate::cache::internal::bind::bind_with_options(self, self.change_sets(), std::rc::Rc::new(target), options), read_only)
}
fn bind_read_only_with_adaptor(
&self,
adaptor: std::rc::Rc<dyn crate::binding::IObservableCollectionAdaptor<T, K>>,
) -> (std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>, crate::binding::ReadOnlyObservableCollection<T>)
where
T: PartialEq,
{
let (target, read_only) = crate::cache::internal::bind::new_read_only_target::<T>(None);
(crate::cache::internal::bind::bind_with_adaptor(self.change_sets(), std::rc::Rc::new(target), adaptor), read_only)
}
fn bind_read_only_with_sorted_adaptor(
&self,
adaptor: std::rc::Rc<dyn crate::binding::ISortedObservableCollectionAdaptor<T, K>>,
) -> (std::rc::Rc<dyn ferroui_system::IObservable<crate::cache::ChangeSet<T, K>>>, crate::binding::ReadOnlyObservableCollection<T>)
where
T: PartialEq,
Self: Sized + 'static,
{
let (target, read_only) = crate::cache::internal::bind::new_read_only_target::<T>(None);
(crate::cache::internal::bind::bind_sorted_with_adaptor(crate::cache::internal::bind::expect_sorted_stream(self), std::rc::Rc::new(target), adaptor), read_only)
}
};
}
pub(crate) use bind_methods;