use super::*; pub struct SingleShotEventual where T: Unpin + Clone, { eventual: EventualValueClone, drop_value: T, } impl Drop for SingleShotEventual where T: Unpin + Clone, { fn drop(&mut self) { self.eventual.resolve(self.drop_value.clone()); } } impl SingleShotEventual where T: Unpin + Clone, { pub fn new(drop_value: T) -> Self { Self { eventual: EventualValueClone::new(), drop_value: drop_value, } } // Can only call this once, it consumes the eventual pub fn resolve(self, value: T) -> EventualResolvedFuture> { self.eventual.resolve(value) } pub fn instance(&self) -> EventualValueCloneFuture { self.eventual.instance() } }