None
EN
Persian Rug, Part 3 - The warp and the weft
['Persian Rug', 'Part - The Warp', 'The Weft', 'Edmund Smith']
Collabora Newsroom RSS Feed
struct User { groups: Vec < usize >, } struct Group { leader: Option < usize > } struct Container { users: Vec <User>, groups: Vec <Group> } rust use persian_rug::{contextual, persian_rug, Proxy}; #[contextual(Rug)] struct User { groups: Vec <Proxy<Group>>, } #[contextual(Rug)] struct Group { leader: Option <Proxy<User>> } #[persian_rug] #[derive(Default)] struct Rug (#[table] User, #[table] Group); let r: Rug = Default:: default (); let u = r .add (User { groups: Vec:: new () }); let g = r .add (Group { leader: Some (u) }); r .get_mut (&u).groups .push (g); Since there is one container type that can ever hold objects of a given type, the originating container type for each proxy is unambiguous.