Refactor: Bundle Window and Surface into single struct with proper lifetimes #604
Labels
No labels
Context: Async
Context: Bug
Context: CI
Context: Dependencies
Context: Documentation
Context: Enhancement
Context: Example
Context: Macro
Context: Runtime
Difficulty: Easy
Difficulty: Hard
Difficulty: Medium
Platform: Android
Platform: Linux
Platform: Web
Platform: Windows
Platform: iOS
Platform: macOS
Type: Discussion
Type: Evaluation
Type: Tracker
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SakulFlee/Orbital#604
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Currently,
RuntimestoresWindowandSurfaceas separateOptionfields, usingtransmuteto castSurface<'w>toSurface<'static>to avoid lifetime parameters. This approach has several issues:Dropimplementation, we're experiencing issues with surface cleanupCurrent code structure
Proposed Solution
Bundle
Window,Surface, and potentiallyInstanceinto a single struct that properly encapsulates their lifetime relationship:Benefits
transmute, let the compiler enforce lifetime correctnessAcceptance Criteria
WindowSurfacestruct that bundles window, surface, and instancetransmutefrom surface creation'wtoRuntimestructDropforWindowSurfaceto ensure correct cleanup orderNotes
The lifetime parameter on
Runtime<'w>should not spread further ifRuntimeis owned by the parent struct (e.g.,App). This is a one-time addition that buys us significant safety guarantees.