Add comment that field projectin also works with mutable fields

This commit is contained in:
Chris Gregory
2019-04-12 01:29:30 -05:00
parent 94a5c3b2b2
commit e9c9d1c305

View File

@@ -171,11 +171,12 @@
//!
//! # Projections and Structural Pinning
//!
//! One interesting question arises when considering the interaction of pinning and
//! the fields of a struct. When can a struct have a "pinning projection", i.e.,
//! an operation with type `fn(Pin<&Struct>) -> Pin<&Field>`?
//! In a similar vein, when can a generic wrapper type (such as `Vec<T>`, `Box<T>`, or `RefCell<T>`)
//! have an operation with type `fn(Pin<&Wrapper<T>>) -> Pin<&T>`?
//! One interesting question arises when considering the interaction of pinning
//! and the fields of a struct. When can a struct have a "pinning projection",
//! i.e., an operation with type `fn(Pin<&Struct>) -> Pin<&Field>`? In a
//! similar vein, when can a generic wrapper type (such as `Vec<T>`, `Box<T>`,
//! or `RefCell<T>`) have an operation with type `fn(Pin<&Wrapper<T>>) ->
//! Pin<&T>` (or similarly `fn(Pin<&mut Wrapper<T>>) -> Pin<&mut T>`)?
//!
//! Having a pinning projection for some field means that pinning is "structural":
//! when the wrapper is pinned, the field must be considered pinned, too.