Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
swift-urlqueryitem-coder Sources URLQueryItemCoder Decoder Generic Implementation DecodingPrimitiveValue.swift
2.5 kB · 105 lines
Swift
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106//// DecodingPrimitiveValue.swift// URLQueryItemCoder//// Created by Kyle Hughes on 1/19/23.//
internal protocol DecodingPrimitiveValue { func decode(_ type: Bool.Type) -> Bool? func decode(_ type: Double.Type) -> Double? func decode(_ type: Float.Type) -> Float? func decode(_ type: Int.Type) -> Int? func decode(_ type: Int8.Type) -> Int8? func decode(_ type: Int16.Type) -> Int16? func decode(_ type: Int32.Type) -> Int32? func decode(_ type: Int64.Type) -> Int64? func decode(_ type: String.Type) -> String? func decode(_ type: UInt.Type) -> UInt? func decode(_ type: UInt8.Type) -> UInt8? func decode(_ type: UInt16.Type) -> UInt16? func decode(_ type: UInt32.Type) -> UInt32? func decode(_ type: UInt64.Type) -> UInt64? func decodeNil() -> Bool}
// MARK: - Conformance for String
extension String: DecodingPrimitiveValue { // MARK: Internal Instance Interface @inlinable internal func decode(_ type: Bool.Type) -> Bool? { type.init(self) } @inlinable internal func decode(_ type: Double.Type) -> Double? { type.init(self) } @inlinable internal func decode(_ type: Float.Type) -> Float? { type.init(self) } @inlinable internal func decode(_ type: Int.Type) -> Int? { type.init(self) } @inlinable internal func decode(_ type: Int8.Type) -> Int8? { type.init(self) } @inlinable internal func decode(_ type: Int16.Type) -> Int16? { type.init(self) } @inlinable internal func decode(_ type: Int32.Type) -> Int32? { type.init(self) } @inlinable internal func decode(_ type: Int64.Type) -> Int64? { type.init(self) } @inlinable internal func decode(_ type: String.Type) -> String? { self } @inlinable internal func decode(_ type: UInt.Type) -> UInt? { type.init(self) } @inlinable internal func decode(_ type: UInt8.Type) -> UInt8? { type.init(self) } @inlinable internal func decode(_ type: UInt16.Type) -> UInt16? { type.init(self) } @inlinable internal func decode(_ type: UInt32.Type) -> UInt32? { type.init(self) } @inlinable internal func decode(_ type: UInt64.Type) -> UInt64? { type.init(self) } @inlinable internal func decodeNil() -> Bool { false }}