mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
f250ad7b40
add rw locks usage
19 lines
386 B
Swift
19 lines
386 B
Swift
// Copyright 2019 Yandex LLC. All rights reserved.
|
|
|
|
public typealias NonEmptyArray<Element> = NonEmpty<[Element]>
|
|
|
|
extension NonEmpty {
|
|
@inlinable
|
|
public init?<E>(_ array: C) where C == [E] {
|
|
guard let head = array.first else {
|
|
return nil
|
|
}
|
|
self.init(head, Array(array.dropFirst()))
|
|
}
|
|
|
|
@inlinable
|
|
public func asArray() -> [C.Element] {
|
|
Array(self)
|
|
}
|
|
}
|