Closed
Description
use std::ops::Deref;
pub struct Base;
impl Base {
pub fn asdf(&self) {}
}
pub struct LevelOne {
pub base: Base,
}
impl Deref for LevelOne {
type Target = Base;
fn deref(&self) -> &Base {
&self.base
}
}
impl LevelOne {
pub fn qwop(&self) {}
}
pub struct LevelTwo {
pub base: LevelOne,
}
impl Deref for LevelTwo {
type Target = LevelOne;
fn deref(&self) -> &LevelOne {
&self.base
}
}
impl LevelTwo {
pub fn custom() {}
}
In this example, LevelTwo
derefs to LevelOne
, which derefs to Base
. However in the docs, only the methods from LevelOne
are shown. We should recursively look for Deref impls on items we're collecting impls for via Deref.