Skip to content

feat: add forwarding impl PageTableFrameMapping for &P #556

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

Merged

Conversation

mkroening
Copy link
Member

Since all methods of PageTableFrameMapping take self by reference, we can implement PageTableFrameMapping for all &P where P: PageTableMapping.

This is useful whenever we need a P: PageTableMapping by value, but we only have a &P, for example from MappedPageTable::page_table_frame_mapping(&self) -> &P.

Copy link
Member

@Freax13 Freax13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

This seems reasonable. I don't expect us to add methods that take a mutable reference in the future.

@Freax13 Freax13 merged commit 72954bb into rust-osdev:master Jul 6, 2025
8 of 12 checks passed
@mkroening mkroening deleted the forward-page_table_frame_mapping branch July 6, 2025 16:57
@mkroening mkroening restored the forward-page_table_frame_mapping branch July 6, 2025 16:57
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

Successfully merging this pull request may close these issues.

2 participants