withExtendedLifetime

func withExtendedLifetime(_:_:)(_ x: T, _ body: () throws -> Result) rethrows -> Result

Evaluates a closure while ensuring that the given instance is not destroyed before the closure returns.

func withExtendedLifetime(_:_:)(_ x: T, _ body: (T) throws -> Result) rethrows -> Result

Evaluates a closure while ensuring that the given instance is not destroyed before the closure returns.