Skip to content

Commit

Permalink
Return backward compatibility of Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Nov 9, 2023
1 parent 4232c2c commit d854d85
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ public class Resource<T> {
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 {
Expand Down

0 comments on commit d854d85

Please sign in to comment.