use proc_macro2::TokenStream;
use quote::quote;
pub(super) fn hook_methods() -> TokenStream {
quote! {
pub fn on_reload<__DynamicConfigHook>(hook: __DynamicConfigHook)
where
__DynamicConfigHook: ::core::ops::Fn(
&::std::sync::Arc<Self>,
&::std::sync::Arc<Self>,
) + ::core::marker::Send
+ ::core::marker::Sync
+ 'static,
{
Self::dynamic_config_cell().on_reload(hook);
}
#[must_use = "dropping the guard unregisters the hook; bind it for \
as long as the hook should fire"]
pub fn on_reload_scoped<__DynamicConfigHook>(
hook: __DynamicConfigHook,
) -> ::dynamic_config::HookGuard<Self>
where
__DynamicConfigHook: ::core::ops::Fn(
&::std::sync::Arc<Self>,
&::std::sync::Arc<Self>,
) + ::core::marker::Send
+ ::core::marker::Sync
+ 'static,
{
Self::dynamic_config_cell().on_reload_scoped(hook)
}
}
}