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

Create a more ergonomic model for protocols and handles #29

Open
gurry opened this issue Jul 11, 2018 · 0 comments
Open

Create a more ergonomic model for protocols and handles #29

gurry opened this issue Jul 11, 2018 · 0 comments
Assignees

Comments

@gurry
Copy link
Owner

gurry commented Jul 11, 2018

Currently we have to call the raw UEFI code to create device handles and install protocols. Create a model that's more ergonomic and safe. For example we could have a type called Handle with methods like InstallProtocol() and UninstallProtocol(). These methods would take any type that implements a trait called Protocol. The trait will have a static field called guid() which the Handle can internally to register the protocol with UEFI.

The Handle will take ownership of all protocol instances passed to it and keep maybe dyn references to them in a vector. A Protocol implementation will be needed per protocol and will have methods on it specific to the protocol. The Handle will support querying for a protocol using the GUID. It will also uninstall all protocols it's currently holding in its Drop.

To make things more strongly typed we could find a way to have multiple different Handle types such as DeviceHandle, ImageHandle etc. In that case maybe Handle will be a trait rather than struct.

@gurry gurry self-assigned this Jul 11, 2018
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

1 participant