pub struct CustomCleanupStrategy<F, Fut>{ /* private fields */ }Expand description
Wrapper for custom cleanup strategies provided via closures.
This allows users to provide their own cleanup logic as a closure that returns a Future<Output = bool>.
Implementations§
Source§impl<F, Fut> CustomCleanupStrategy<F, Fut>
impl<F, Fut> CustomCleanupStrategy<F, Fut>
Sourcepub fn new(strategy_fn: F) -> Self
pub fn new(strategy_fn: F) -> Self
Creates a new custom cleanup strategy from a closure.
§Arguments
strategy_fn- A closure that returns a Future<Output = bool> indicating whether cleanup should be triggered
§Example
use nonce_auth::nonce::cleanup::CustomCleanupStrategy;
let strategy = CustomCleanupStrategy::new(|| async {
// Custom cleanup logic - e.g., cleanup every other call
static mut COUNTER: u32 = 0;
unsafe {
COUNTER += 1;
COUNTER % 2 == 0
}
});Trait Implementations§
Source§impl<F, Fut> CleanupStrategy for CustomCleanupStrategy<F, Fut>
impl<F, Fut> CleanupStrategy for CustomCleanupStrategy<F, Fut>
Auto Trait Implementations§
impl<F, Fut> Freeze for CustomCleanupStrategy<F, Fut>where
F: Freeze,
impl<F, Fut> RefUnwindSafe for CustomCleanupStrategy<F, Fut>where
F: RefUnwindSafe,
impl<F, Fut> Send for CustomCleanupStrategy<F, Fut>
impl<F, Fut> Sync for CustomCleanupStrategy<F, Fut>
impl<F, Fut> Unpin for CustomCleanupStrategy<F, Fut>where
F: Unpin,
impl<F, Fut> UnwindSafe for CustomCleanupStrategy<F, Fut>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more