[Future] RigidArray, DynamicArray: Add span properties

This commit is contained in:
Karoy Lorentey committed 2024-08-19 19:44:14 -07:00
1 parent 4d38958804
commit 0e7c4655be
2 files changed
+12

No files matched your search

@@ -28,6 +28,12 @@ extension DynamicArray where Element: ~Copyable {
public var capacity: Int { _storage.capacity }
}
extension DynamicArray where Element: ~Copyable {
public var span: Span<Element> {
_storage.span
}
}
extension DynamicArray: RandomAccessContainer where Element: ~Copyable {
public typealias BorrowingIterator = RigidArray<Element>.BorrowingIterator
public typealias Index = Int
@@ -47,6 +47,12 @@ extension RigidArray where Element: ~Copyable {
public var isFull: Bool { freeCapacity == 0 }
}
extension RigidArray where Element: ~Copyable {
public var span: Span<Element> {
Span(unsafeElements: _items, owner: self)
}
}
extension RigidArray: RandomAccessContainer where Element: ~Copyable {
public struct BorrowingIterator: BorrowingIteratorProtocol, ~Escapable {
@usableFromInline