Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. pub struct Graphics;
  2.  
  3. struct Frame<'g> {
  4. graphics: &'g mut Graphics,
  5. }
  6.  
  7. struct Paint<'g, 'f> {
  8. frame: &'f mut Frame<'g>,
  9. }
  10.  
  11. impl Graphics {
  12. fn frame(&mut self) -> Frame<'_> {
  13. Frame {
  14. graphics: self,
  15. }
  16. }
  17. }
  18.  
  19.  
  20. impl<'g> Frame<'g> {
  21. fn paint(&mut self) -> Paint<'g, '_> {
  22. Paint {
  23. frame: self,
  24. }
  25. }
  26.  
  27. fn draw(&mut self) {}
  28. }
  29.  
  30. impl<'g, 'f> Paint<'g, 'f> {
  31. fn glyph(&mut self) {
  32.  
  33. }
  34. }
  35.  
  36. fn main() {
  37. let mut graphics = Graphics;
  38. let mut frame = graphics.frame();
  39. frame.paint().glyph();
  40. frame.draw();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement