implement Log on more foreign types #458

Closed
opened 2021-07-09 10:58:17 -05:00 by piegamesde · 3 comments
piegamesde commented 2021-07-09 10:58:17 -05:00 (Migrated from github.com)

We already have impl <T: Log> Log for Box<T>. It would be cool to have this for more types, for example Cow<'static, T: Log>, Rc etc.

I'd have to double-check, but this may even be generalizable to impl <T, R> Log for T where T: Borrow<R>, R: Log

We already have `impl <T: Log> Log for Box<T>`. It would be cool to have this for more types, for example `Cow<'static, T: Log>`, `Rc` etc. I'd have to double-check, but this may even be generalizable to `impl <T, R> Log for T where T: Borrow<R>, R: Log`
KodrAus commented 2021-11-14 23:19:51 -06:00 (Migrated from github.com)

The general impl based on Borrow is probably not one we'd want to take on, just because once you have such a broad blanket implementation you end up somewhat painted into a corner with any additional ones you might consider.

I think a bunch of common shared container types would be worthwhile:

  • &'a T: Log + ?Sized
  • Rc<T: Log>
  • Arc<T: Log>
The general impl based on `Borrow` is probably not one we'd want to take on, just because once you have such a broad blanket implementation you end up somewhat painted into a corner with any additional ones you might consider. I think a bunch of common shared container types would be worthwhile: - `&'a T: Log + ?Sized` - `Rc<T: Log>` - `Arc<T: Log>`
piegamesde commented 2021-11-15 04:08:25 -06:00 (Migrated from github.com)

just because once you have such a broad blanket implementation you end up somewhat painted into a corner with any additional ones you might consider.

Yes. This is a topic where impl specialization would be really helpful.

I think a bunch of common shared container types would be worthwhile

Would you be interested in a PR?

> just because once you have such a broad blanket implementation you end up somewhat painted into a corner with any additional ones you might consider. Yes. This is a topic where [impl specialization](https://rust-lang.github.io/rfcs/1210-impl-specialization.html) would be really helpful. > I think a bunch of common shared container types would be worthwhile Would you be interested in a PR?
KodrAus commented 2021-11-15 04:27:25 -06:00 (Migrated from github.com)

Would you be interested in a PR?

Absolutely! 🙏

> Would you be interested in a PR? Absolutely! 🙏
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-rust-lang/log#458
No description provided.