From 6f3feca71d4b686edecd7e24347b6e5ed35ed5e0 Mon Sep 17 00:00:00 2001 From: Javier Cardona Date: Fri, 5 May 2023 13:26:06 +0100 Subject: [PATCH] Add DFUClass::release() function --- CHANGELOG.md | 2 ++ src/class.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3f0982..54ddf09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/class.rs b/src/class.rs index 655e550..98d6b43 100644 --- a/src/class.rs +++ b/src/class.rs @@ -630,6 +630,12 @@ impl DFUClass { } } + /// 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`.