[−][src]Trait photonix::focus::composites::GetRefThird
A variant of GetRef
, reaching three levels deep in the data structure.
Examples
#[derive(GetRef)] pub struct Employee { pub name: String, pub company: Company } #[derive(GetRef)] pub struct Company { pub name: String, pub address: Address } #[derive(GetRef)] pub struct Address(String); // Level 1 Level 2 Level 3 Parent type // | | | | impl<'a> GetRefThird<'a, Company, Address, String> for Employee {} let john_doe = Employee { name: String::from("John Doe"), company: Company { name: String::from("Acme Corporation"), address: Address(String::from("4 Foo Road, Bar City")), } }; let company_address = john_doe.get_ref_third(); assert_eq!("4 Foo Road, Bar City", company_address.as_str());