Open
Description
Here's a relatively minimal example that demonstrates the problem:
pub type Color1 = (u8, u8, u8, u8);
pub struct Color2 {
r: u8,
g: u8,
b: u8,
a: u8,
}
impl Color2 {
pub fn new_with_alpha(r: u8, g: u8, b: u8, a: u8) -> Self {
Self { r, g, b, a }
}
}
impl From<Color2> for Color1 {
fn from(c: Color2) -> Self {
(c.r, c.g, c.b, c.a)
}
}
impl From<Color1> for Color2 {
fn from((r, g, b, a): Color1) -> Self {
Self::new_with_alpha(r, g, b, a)
}
}
If you run cargo doc
on this, you'll get this:
As you can see, it says From<(u8, u8, u8, u8)> for Color2
, despite saying Color1
everywhere else, including on the fn from(...)
in the From
implementation. I expected to get Color1
in the From<...>
too.