Skip to content

Commit

Permalink
Merge pull request #9 from jcard0na/main
Browse files Browse the repository at this point in the history
Add DFUClass::release() function
  • Loading branch information
vitalyvb authored May 6, 2023
2 parents 099c188 + 6f3feca commit 5862829
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- New `DFUClass::release()` to consume class and release owned memory argument.

## [0.3.0] - 2023-03-18

### Breaking Changes
Expand Down
6 changes: 6 additions & 0 deletions src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,12 @@ impl<B: UsbBus, M: DFUMemIO> DFUClass<B, M> {
}
}

/// This function will consume self and return the owned memory
/// argument that was moved in the call to new()
pub fn release(self) -> M {
self.mem
}

/// This function may be called just after `DFUClass::new()` to
/// set DFU error state to "Device detected unexpected power on reset"
/// instead of the usual `dfuIdle`.
Expand Down

0 comments on commit 5862829

Please sign in to comment.