Files
divkit/client/ios/Core/Base/NonEmpty+Array.swift
T
babaevmm f250ad7b40 open rw locks pr
add rw locks usage
2022-09-26 16:41:40 +03:00

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)
}
}