Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl<T> Write for UniquePtr<T> where ... Pin<&a mut T> : Write. #1405

Merged

Conversation

anforowicz
Copy link
Contributor

This commit implements forwarding of Write 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-Write-for-Box%3CW%3E

This commit has quite similar, orphan-rule-related motivation as the earlier #1368 which covered the Read trait. For a more specific motivating example, please see http://review.skia.org/c/skia/+/923337/3/experimental/rust_png/ffi/FFI.rs#254

@anforowicz
Copy link
Contributor Author

Can you PTAL? FWIW the earlier explanation and discussion from #1368 also apply here - e.g. the earlier PR says why there are no tests, and why it's okay not to worry for now about forwarding other traits.

This commit implements forwarding of `Write` 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-Write-for-Box%3CW%3E

This commit has quite similar, orphan-rule-related motivation as the
earlier dtolnay#1368 which covered the
`Read` trait.  For a more specific motivating example, please see
http://review.skia.org/skia/+/923337/3/experimental/rust_png/ffi/FFI.rs#254
@anforowicz anforowicz force-pushed the write-trait-blanket-impl-for-unique-ptr branch from 83299d1 to a2fe88c Compare November 22, 2024 16:48
@anforowicz
Copy link
Contributor Author

Ooops... I've just realized that one of the links in the commit description doesn't work. Let me fix that in a force push...

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit 0fc0797 into dtolnay:master Nov 22, 2024
16 checks passed
@anforowicz anforowicz deleted the write-trait-blanket-impl-for-unique-ptr branch November 22, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants