Repository navigation
Borrowed<'a, T> RFC - #1788
Borrowed<'a, T> RFC#1788
Borrowed<'a, T> RFC#1788Conversation
|
Should I/O Safety be mentioned? In particular
It looks to be nearing stabilization now so I think it would be good to have an interop story, if possible. EDIT: Ah the expanded section on "blittable types" clarifies there is a difference here. |
|
Apologies for the drive-by bikeshedding comment, but since |
|
Since this is the first RFC-style PR, I'll just leave a meta comment that GitHub doesn't have a great markdown review experience. I realize you mitigate the issue with a preview link, but without an easy way to preview the actual content of the PR its less than ideal. The comment granularity also isn't ideal (e.g. large paragraphs). The five minutes I spent with hackmd.io has already spoiled me. 😁 |
This has already been noted in the RFC. We'll definitely want to figure this out before merging. |
|
How about "Loaned"? |
|
I've renamed the type to |
| fn from(item: &'a IDWriteFontFamily2) -> Self { | ||
| // Note: we may want to consider implementing `Deref` | ||
| // for COM interfaces so that children can be | ||
| // dereferenced into their parents. But this is |
There was a problem hiding this comment.
This would work for COM interface hierarchies (as the memory layout is the same) but not for WinRT interface and class hierarchies. They would still need a param trait or explicit try_into pattern.
This introduces an RFC for a
Borrowed<'a, T>type which models a type that is logically borrowed but still passed by value. As the motivation explains, this is needed to bridge the gap between Rust's ownership semantics and the looser requirements of C and C++.Introducing this would not only simplify codegen considerably but would also address issues like #1410.
[rendered]