Conversation
|
Note to reviewers: this isn't originally my code, and I haven't worked with it extensively. If something seems wrong to you, please speak up! |
soqb
left a comment
There was a problem hiding this comment.
i think the docs are sound. i just have a few comments/questions !
BD103
left a comment
There was a problem hiding this comment.
Fun trick that I learned from this Linebender blog post:
You can make the header hidden in the generated Rustdoc with a bit of HTML and CSS.
Co-authored-by: Martín Maita <47983254+mnmaita@users.noreply.github.com>
Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
|
Thanks for all the feedback <3 |
MrGVSV
left a comment
There was a problem hiding this comment.
Looks good! I find myself wanting something like this a lot.
My one critique of this crate is that it doesn't seem to support From<T>/Into<T>. I get this is a limitation due to the impl for &'static T, but it does seem to make this a lot harder to use with third-party types.
For example, if Bevy chooses not to implement From<TypeInfo> for CowArc<'static, TypeInfo>, then a given a fn(impl Into<CowArc<'static, TypeInfo>), users would have to have to either do: my_func(&info) or my_func(CowArc::Owned(Arc::new(info))).
At the very least I think we should either support From<Arc<T>> or add a dedicated new_owned constructor.
| A [`Cow`](https://doc.rust-lang.org/std/borrow/enum.Cow.html)-like data structure where owned data is stored inside an [`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html). | ||
| Here's what it looks like: | ||
|
|
||
| ```rust, ignore |
There was a problem hiding this comment.
I think we should include an example of usage somewhere here. I find it's often very helpful to see the intended usage of a crate before I start digging through the docs manually.
I think a big selling point of this crate is the automatic 'static preservation when using From/Into. We can probably highlight this in an example.
Fixes #7.