Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::{marker::PhantomPinned, pin::Pin};
- struct Foo(PhantomPinned);
- impl Foo {
- fn new() -> Self {
- Foo(PhantomPinned)
- }
- fn poll(self: Pin<&mut Self>) {
- println!("Polled on {}", std::thread::current().name().unwrap())
- }
- }
- fn main() {
- let mut foo = Box::pin(Foo::new());
- foo.as_mut().poll();
- std::thread::Builder::new()
- .name("not main".into())
- .spawn(move || foo.as_mut().poll())
- .unwrap()
- .join()
- .unwrap();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement