Resource Lifecycle Layer 2: Design Choices Core Question When should this resource be created, used, and cleaned up? Before implementing lifecycle: - What's the resource's scope? - Who owns the cleanup responsibility? - What happens on error? --- Lifecycle Pattern → Implementation | Pattern | When | Implementation | |---------|------|----------------| | RAII | Auto cleanup | trait | | Lazy init | Deferred creation | , | | Pool | Reuse expensive resources | , | | Guard | Scoped access | pattern | | Scope | Transaction boundary | Custom struct + Drop | --- Thinking Prompt Before designing lifec…