std-method
Pin::into_inner: recover the underlying pointer
For an Unpin target, recover the original pointer safely. This consumes the pinning wrapper. The normal restrictions on borrows and ownership still apply. Expected stdout (not executed): cats Common mistake: Assuming into_inner can unwrap a pin whose target relies on its location.
Formal Syntax & Structure
rust syntaxrust
Pin::into_inner(pin) -> Ptr where Ptr::Target: UnpinWorking Example
Example Snippetrust
fn main() { use std::pin::Pin; let p = Box::pin(String::from("cat")); let mut owned: Box<String> = Pin::into_inner(p); owned.push('s'); println!("{}", owned);}