Files
swift-collections/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift
T

30 lines
840 B
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2025 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
//
//===----------------------------------------------------------------------===//
#if !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities
import ContainersPreview
#endif
#if compiler(>=6.2)
@available(SwiftStdlib 5.0, *)
extension UniqueDeque where Element: ~Copyable {
@_alwaysEmitIntoClient
@_transparent
public mutating func prepend(_ newElement: consuming Element) {
_ensureFreeCapacity(1)
_storage._handle.uncheckedPrepend(newElement)
}
}
#endif