A general collection is not contiguous, and therefore cannot vend a MutableSpan
property over its contents. It would be feasible to provide either an optional mutable span (a la withContiguousMutableStorageIfAvailable
),¹ or a closure-taking operation, but it likely makes sense to delay designing that to go with a more systematic proposal rethinking collections to account for ~Copyable/~Escapable constraints.
¹ well, it would be possible once Optional supports ~Escapable wrapped types.