Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. use std::pin::Pin;
  2.  
  3. struct A {
  4. a: i32,
  5. b: i32,
  6. }
  7.  
  8. impl A {
  9. // fn t(&mut self) { 只要self不是Pin就不会出错
  10. fn t(mut self: Pin<&mut Self>) {
  11. let b_a = &mut self.a;
  12. Pin::new(&mut self.b);
  13. *b_a = 10;
  14. }
  15. }
  16.  
  17. fn main() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement