You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
impl<T> Read for UniquePtr<T> where ... Pin<&a mut T> : Read.
This commit implements forwarding of `Read` trait implementation from
`UniquePtr<T>` to the pointee type. This is quite similar to how
`Box<T>` also forwards - see
https://doc.rust-lang.org/std/boxed/struct.Box.html#impl-Read-for-Box%3CR%3E
Just as with `Box<T>`, the `impl` cannot be provided in the crate
introducing `T`, because this violates the orphan rule. This means that
before this commit a wrapper newtype would be required to work around
the orphan rule - e.g.:
```
struct UniquePtrOfReadTrait(cxx::UniquePtr<ffi::ReadTrait>);
impl Read for UniquePtrOfReadTrait { … }
```
After this commit, one can provide an `impl` that works more directly
with the C++ type `T` (the FFI will typically require passing `self:
Pin<&mut ffi::ReadTrait>`):
```
impl<'a> Read for Pin<&'a mut ffi::ReadTrait> { … }
```
For a more specific motivating example, please see:
https://docs.google.com/document/d/1EPn1Ss-hfOC6Ki_B5CC6GA_UFnY3TmoDLCP2HjP7bms
0 commit comments