Files
swift-collections/Sources/DequeModule/Deque._Storage.swift
T
Karoy Lorentey 75aa5b0755 Hypo → Rigid, Dyno → Dynamic
Let’s try these on for size. The greek prefixes work great, but their capitalization looks bad, and they do not interact well with compound names. (`OrderedHyposet`?)
2024-08-12 13:35:42 -07:00

58 lines
1.5 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2021 - 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
extension Deque {
@usableFromInline
internal final class _Storage {
@usableFromInline
@exclusivity(unchecked)
internal var _value: RigidDeque<Element>
@inlinable
@inline(__always)
internal init(_ value: consuming RigidDeque<Element>) {
self._value = value
}
@inlinable
internal convenience init(capacity: Int) {
self.init(RigidDeque(capacity: capacity))
}
}
}
extension Deque._Storage: CustomStringConvertible {
@usableFromInline
internal var description: String {
"Deque<\(Element.self)>._Storage\(_value._handle.description)"
}
}
extension Deque._Storage {
#if COLLECTIONS_INTERNAL_CHECKS
@usableFromInline @inline(never) @_effects(releasenone)
internal func _checkInvariants() {
_value._checkInvariants()
}
#else
@inlinable @inline(__always)
internal func _checkInvariants() {}
#endif // COLLECTIONS_INTERNAL_CHECKS
}
extension Deque._Storage {
@inlinable
internal var capacity: Int { _value.capacity }
@inlinable
internal var startSlot: _DequeSlot { _value._handle.startSlot }
}