• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


29 Nov, 2024

Updated at 02 Dec, 2024

Overly strict conflicting implementation checking?

I want to do something like the following

use std::ops::Deref;

struct Struct;

impl<T: Deref<Target=str>> From<T> for Struct { ... }

impl<T: Deref<Target=[u8]>> From<T> for Struct { ... }

Which causes a conflicting implementations error. From my understanding it should be impossible to have conflicting implementations since you can't implement Deref with two different Target types for any T so there will never be ambiguity. Am I missing something?

1 post - 1 participant

Read full topic