Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
swift-urlqueryitem-coder Sources URLQueryItemCoder Encoder Generic Implementation EncodingContainer+Keyed+Wrapper.swift
4.3 kB · 132 lines
Swift
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133//// EncodingContainer+Keyed+Wrapper.swift// URLQueryItemCoder//// Created by Kyle Hughes on 1/15/23.//
extension EncodingContainer.Keyed { internal struct Wrapper<Key> where Key: CodingKey { internal let base: EncodingContainer.Keyed // MARK: Internal Initialization internal init(_ base: EncodingContainer.Keyed) { self.base = base } }}
// MARK: - KeyedEncodingContainerProtocol Extension
extension EncodingContainer.Keyed.Wrapper: KeyedEncodingContainerProtocol { // MARK: Internal Instance Interface @inlinable internal var codingPath: [CodingKey] { base.codingPath } @inlinable internal func encode(_ value: Bool, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Double, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Float, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Int, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Int8, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Int16, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Int32, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: Int64, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: String, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: UInt, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: UInt8, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: UInt16, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: UInt32, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode(_ value: UInt64, forKey key: Key) throws { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encode<T>(_ value: T, forKey key: Key) throws where T : Encodable { try base.encode(value, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func encodeNil(forKey key: Key) throws { try base.encodeNil(forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func nestedContainer<NestedKey>( keyedBy keyType: NestedKey.Type, forKey key: Key ) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey { base.nestedContainer(keyedBy: keyType, forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer { base.nestedUnkeyedContainer(forKey: StringCodingKey(stringValue: key.stringValue)) } @inlinable internal func superEncoder() -> Encoder { base.superEncoder() } @inlinable internal func superEncoder(forKey key: Key) -> Encoder { base.superEncoder(forKey: StringCodingKey(stringValue: key.stringValue)) }}