Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate futures;
- extern crate tokio;
- use futures::{Future, Async};
- #[derive(Clone)]
- pub struct HoldMe{}
- impl Drop for HoldMe{
- fn drop(&mut self) {
- panic!("HoldMe is dropped");
- }
- }
- struct Never{}
- impl Future for Never{
- type Item = ();
- type Error = ();
- fn poll (&mut self) -> Result<Async<()>, ()> {
- Ok(Async::NotReady)
- }
- }
- pub fn main() {
- tokio::run(futures::lazy(move || {
- let hold = HoldMe{};
- Never{}
- .map(move |_|{
- println!("dropping now");
- drop(hold);
- })
- }));
- }
Add Comment
Please, Sign In to add comment