Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FrontendRegion, changing Frontend and PrettyScreen traits #12

Closed
e-matteson opened this issue Jun 13, 2019 · 3 comments
Closed

Add FrontendRegion, changing Frontend and PrettyScreen traits #12

e-matteson opened this issue Jun 13, 2019 · 3 comments

Comments

@e-matteson
Copy link
Collaborator

Paste notes in a comment?

@justinpombrio
Copy link
Owner

struct FrontEndScreen<'a, T: FrontEnd> {
    frontend: &'a mut T,
    region: Region
}

trait Frontend {
    fn print();
    fn get_screen<'a>(region: &'a mut Region) -> FrontendScreen<'a, Self>;
}

impl<'a, T> PrettyScreen for FrontEndScreen<'a, T> {
    fn print(&mut self, pos) {
        self.frontend.print(OFFSET(self.region, pos));
    }
}

@justinpombrio
Copy link
Owner

(Should probably call it a FrontendScreen rather than a FrontendRegion, since the point is that it implements PrettyScreen.)

@e-matteson
Copy link
Collaborator Author

Closed by #19, though with different design and names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants