use std::any::Any;
pub struct ContinuationPoint {
payload: Box<dyn Any + Send + Sync + 'static>,
}
impl ContinuationPoint {
pub fn new<T: Send + Sync + 'static>(item: Box<T>) -> Self {
Self { payload: item }
}
pub fn get<T: Send + Sync + 'static>(&self) -> Option<&T> {
self.payload.downcast_ref()
}
pub fn get_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T> {
self.payload.downcast_mut()
}
pub fn take<T: Send + Sync + 'static>(self) -> Option<Box<T>> {
self.payload.downcast().ok()
}
}
pub(crate) struct EmptyContinuationPoint;