Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub struct Graphics;
- struct Frame<'g> {
- graphics: &'g mut Graphics,
- }
- struct Paint<'g, 'f> {
- frame: &'f mut Frame<'g>,
- }
- impl Graphics {
- fn frame(&mut self) -> Frame<'_> {
- Frame {
- graphics: self,
- }
- }
- }
- impl<'g> Frame<'g> {
- fn paint(&mut self) -> Paint<'g, '_> {
- Paint {
- frame: self,
- }
- }
- fn draw(&mut self) {}
- }
- impl<'g, 'f> Paint<'g, 'f> {
- fn glyph(&mut self) {
- }
- }
- fn main() {
- let mut graphics = Graphics;
- let mut frame = graphics.frame();
- frame.paint().glyph();
- frame.draw();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement