[−][src]Trait photonix::focus::composites::GetRefSecond
A variant of GetRef
, reaching two 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 } pub struct Address(String); // Level 1 Level 2 Parent type // | | | impl<'a> GetRefSecond<'a, Company, 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_name = john_doe.get_ref_second(); assert_eq!("Acme Corporation", company_name.as_str());