4 use std::task::{Context, Poll};
9 fn pin_ref(self: Pin<&Self>) -> Pin<&Self> { self }
11 fn pin_mut(self: Pin<&mut Self>) -> Pin<&mut Self> { self }
13 fn pin_pin_pin_ref(self: Pin<Pin<Pin<&Self>>>) -> Pin<Pin<Pin<&Self>>> { self }
15 fn pin_ref_impl_trait(self: Pin<&Self>) -> impl Clone + '_ { self }
17 fn b(self: Pin<&Foo>, f: &Foo) -> Pin<&Foo> { self }
20 type Alias<T> = Pin<T>;
22 fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> Alias<&Self> { self }
25 struct Bar<T: Unpin, U: Unpin> {
30 impl<T: Unpin, U: Unpin> Bar<T, U> {
31 fn fields(self: Pin<&mut Self>) -> (Pin<&mut T>, Pin<&mut U>) {
32 let this = self.get_mut();
33 (Pin::new(&mut this.field1), Pin::new(&mut this.field2))
38 fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
39 -> Poll<std::io::Result<&[u8]>>;
44 impl AsyncBufRead for Baz {
45 fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>)
46 -> Poll<std::io::Result<&[u8]>>
48 Poll::Ready(Ok(&self.get_mut().0))
54 { Pin::new(&foo).pin_ref() };
55 { Pin::new(&mut foo).pin_mut() };
56 { Pin::new(Pin::new(Pin::new(&foo))).pin_pin_pin_ref() };
57 { Pin::new(&foo).pin_ref_impl_trait() };
58 let mut bar = Bar { field1: 0u8, field2: 1u8 };
59 { Pin::new(&mut bar).fields() };