Do I have to implement a trait twice when implementing it for both reference and non-reference types?

This is a good example for the Borrow trait.

use std::borrow::Borrow;

struct Bar;

trait Foo {
    fn hi(&self);

impl<B: Borrow<Bar>> Foo for B {
    fn hi(&self) {

fn main() {
    let bar = Bar;

Leave a Comment