Files

41 lines
1.4 KiB
Swift
Raw Permalink Normal View History

//
// Id+Literal.swift
// JSONAPI
//
// Created by Mathew Polzin on 11/27/18.
//
import JSONAPI
extension Id: ExpressibleByUnicodeScalarLiteral where RawType: ExpressibleByUnicodeScalarLiteral {
2019-11-05 22:37:48 -08:00
public typealias UnicodeScalarLiteralType = RawType.UnicodeScalarLiteralType
public init(unicodeScalarLiteral value: RawType.UnicodeScalarLiteralType) {
self.init(rawValue: RawType(unicodeScalarLiteral: value))
}
}
extension Id: ExpressibleByExtendedGraphemeClusterLiteral where RawType: ExpressibleByExtendedGraphemeClusterLiteral {
2019-11-05 22:37:48 -08:00
public typealias ExtendedGraphemeClusterLiteralType = RawType.ExtendedGraphemeClusterLiteralType
public init(extendedGraphemeClusterLiteral value: RawType.ExtendedGraphemeClusterLiteralType) {
self.init(rawValue: RawType(extendedGraphemeClusterLiteral: value))
}
}
extension Id: ExpressibleByStringLiteral where RawType: ExpressibleByStringLiteral {
2019-11-05 22:37:48 -08:00
public typealias StringLiteralType = RawType.StringLiteralType
public init(stringLiteral value: RawType.StringLiteralType) {
self.init(rawValue: RawType(stringLiteral: value))
}
}
extension Id: ExpressibleByIntegerLiteral where RawType: ExpressibleByIntegerLiteral {
2019-11-05 22:37:48 -08:00
public typealias IntegerLiteralType = RawType.IntegerLiteralType
public init(integerLiteral value: IntegerLiteralType) {
self.init(rawValue: RawType(integerLiteral: value))
}
}