[−][src]Trait photonix::focus::composites::SetThird
A variant of Set
, reaching three levels deep in the data structure.
Examples
#[derive(Get, Modify)] pub struct Employee { pub name: String, pub company: Company } #[derive(Get, Modify)] pub struct Company { pub name: String, pub address: Address } #[derive(Get, Set)] pub struct Address(String); // Level 1 Level 2 Level 3 Parent type // | | | | impl SetThird<Company, Address, String> for Employee {} impl GetThird<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 john_doe_new = john_doe.set_third(String::from("3 Baz Road, Qux City")); assert_eq!("3 Baz Road, Qux City", john_doe_new.get_third().as_str());
Provided methods
fn set_third(self, new_value: LevelThree) -> Self
Implementations on Foreign Types
impl<LevelOne, LevelTwo, LevelThree> SetThird<LevelOne, LevelTwo, LevelThree> for Option<LevelOne> where
LevelOne: Modify<LevelTwo>,
LevelTwo: Set<LevelThree>,
[src]
Loading content...
LevelOne: Modify<LevelTwo>,
LevelTwo: Set<LevelThree>,