-
Notifications
You must be signed in to change notification settings - Fork 63
Introduce extension trait for attaching #675
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,3 +227,16 @@ pub fn attach_for_flashing( | |
| ) -> Result<Box<dyn Core>> { | ||
| attach_to_chip(probe, Some(chip), speed_khz) | ||
| } | ||
|
|
||
| /// Extension trait to make it easier for libraries to attach | ||
| /// to chips. It is encourageed to extend this trait as | ||
| /// needed to make developer's lives easier. | ||
| pub trait HubrisAttach { | ||
| fn attach_to_chip(&self, probe: &str) -> Result<Box<dyn Core>>; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe document what this is supposed to do and when this should/shouldn't fail? |
||
| } | ||
|
|
||
| impl HubrisAttach for humility::hubris::HubrisArchive { | ||
| fn attach_to_chip(&self, probe: &str) -> Result<Box<dyn Core>> { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a check, do we want this to be Perf wise it probably doesn't matter, but just checking because sometimes
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah we return |
||
| attach_to_chip(probe, self.chip().as_deref(), None) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.