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

Drop the Default bound on the peripheral traits #176

Open
2 tasks
rrbutani opened this issue Jul 28, 2022 · 0 comments
Open
2 tasks

Drop the Default bound on the peripheral traits #176

rrbutani opened this issue Jul 28, 2022 · 0 comments
Assignees
Labels
➕ improvement Chores and fixes: the small things. P-low Low priority T-peripheral traits Topic: Peripheral Traits

Comments

@rrbutani
Copy link
Member

what

This was an early design decision we made that, while well-intentioned (the idea, IIRC, was to make the API easier to use; with this bound we'd always be able to provide a Sim::default() function), was probably ill-advised.

For embedded devices in particular this bound is challenging: most peripheral implementations for devices simply need to reference external state and requiring Default makes this impossible without resorting to statics or unsafe.

On hosted platforms, implementing Default on peripheral implementations (like the shims) is still desirable and we can still provide Default implementations on types like Interpreter and Sim by just making those impls contingent on a Default bounded Peripherals type.

steps

  • remove the Default bound on the peripheral traits
  • change impls higher up in the type hierarchy to require : Default as needed

where

branch: imp/drop-default-on-peripheral-traitß

open questions

@rrbutani rrbutani added ➕ improvement Chores and fixes: the small things. P-low Low priority T-peripheral traits Topic: Peripheral Traits labels Jul 28, 2022
@rrbutani rrbutani self-assigned this Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
➕ improvement Chores and fixes: the small things. P-low Low priority T-peripheral traits Topic: Peripheral Traits
Projects
None yet
Development

No branches or pull requests

1 participant