Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftownership borrowing consumingSingle-choice MCQ

A noncopyable struct with a deinit is partially consumed via field access. Given `consume self` is not used, what determines when Resource's deinit runs in this borrowing method?

struct Resource: ~Copyable { let handle: Int deinit { /* close handle */ } borrowing func peek() -> Int { handle } }