diff --git a/Sources/SpellbookFoundation/Types & PropertyWrappers/Resource (RAII).swift b/Sources/SpellbookFoundation/Types & PropertyWrappers/Resource (RAII).swift index f628064..d1527c9 100644 --- a/Sources/SpellbookFoundation/Types & PropertyWrappers/Resource (RAII).swift +++ b/Sources/SpellbookFoundation/Types & PropertyWrappers/Resource (RAII).swift @@ -85,6 +85,14 @@ public class Resource { return currentValue } + /// Disables `free` action when Resource is deinited. + /// + /// Equivalent to `reset(free: false)`. + @discardableResult + public func release() -> T { + reset(free: false) + } + /// Replace `cleanup` function with new one. @discardableResult public func replaceCleanup(_ newCleanup: @escaping (T) -> Void) -> (T) -> Void {