Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::pin::Pin;
- struct A {
- a: i32,
- b: i32,
- }
- impl A {
- // fn t(&mut self) { 只要self不是Pin就不会出错
- fn t(mut self: Pin<&mut Self>) {
- let b_a = &mut self.a;
- Pin::new(&mut self.b);
- *b_a = 10;
- }
- }
- fn main() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement