mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
[Future] RigidArray, DynamicArray: Add span properties
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user