mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
f250ad7b40
add rw locks usage
14 lines
465 B
Swift
14 lines
465 B
Swift
// Copyright 2019 Yandex LLC. All rights reserved.
|
|
|
|
extension UnsignedInteger where Self: FixedWidthInteger {
|
|
/// Creates a new instance from the given integer, if it can be represented
|
|
/// exactly. Otherwise `InvalidArgumentError` will be thrown.
|
|
@inlinable
|
|
public init<T: BinaryInteger>(value: T) throws {
|
|
guard let converted = Self(exactly: value) else {
|
|
throw InvalidArgumentError(name: "value", value: value)
|
|
}
|
|
self = converted
|
|
}
|
|
}
|