mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 18:34:08 +00:00
![]() Put Pin::as_deref_mut in impl Pin<Ptr> / rearrange Pin methods Tracking issue: #86918 Based on the suggestion in https://github.com/rust-lang/rust/issues/86918#issuecomment-2189367582 > Some advantages: > > * Synergy with the existing `as_ref` and `as_mut` signatures (stable since Rust 1.33) > > * Lifetime elision reduces noise in the signature > > * Turbofish less verbose: `Pin::<&mut T>::as_deref_mut` vs `Pin::<&mut Pin<&mut T>>::as_deref_mut` The comment seemed to imply that `Pin::as_ref` and `Pin::as_mut` already share an impl block, which they don't. So, I rearranged it so that they do, and we can see which looks better in the docs. <details><summary><b>Docs screenshots</b></summary> Current nightly:  `Pin::as_deref_mut` moved into the same block as `as_mut`:  `Pin::as_ref`, `as_mut`, and `as_deref_mut` all in the same block:  </details> I think I like the last one the most; obviously I'm biased since I'm the one who rearranged it, but it doesn't make sense to me to have `as_ref` methods split up by an `into_inner` method. r? dtolnay |
||
---|---|---|
.. | ||
alloc | ||
backtrace@72265bea21 | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@d9466edb4c | ||
sysroot | ||
test | ||
unwind | ||
windows_targets | ||
Cargo.lock | ||
Cargo.toml |