mirror of
https://github.com/apple/swift-http-structured-headers
synced 2026-11-26 04:57:47 +00:00
Apply formatting
This commit is contained in:
1 parent
89ef2cf73d
commit
3f73125a0d
28 files changed
+198
-184
No files matched your search
@@ -27,23 +27,23 @@ struct DictionaryKeyedContainer<Key: CodingKey, BaseData: RandomAccessCollection
|
||||
|
||||
extension DictionaryKeyedContainer: KeyedDecodingContainerProtocol {
|
||||
var codingPath: [CodingKey] {
|
||||
return self.decoder.codingPath
|
||||
self.decoder.codingPath
|
||||
}
|
||||
|
||||
var allKeys: [Key] {
|
||||
return self.dictionary.compactMap { Key(stringValue: $0.0) }
|
||||
self.dictionary.compactMap { Key(stringValue: $0.0) }
|
||||
}
|
||||
|
||||
func contains(_ key: Key) -> Bool {
|
||||
return self.dictionary.contains(where: { $0.0 == key.stringValue })
|
||||
self.dictionary.contains(where: { $0.0 == key.stringValue })
|
||||
}
|
||||
|
||||
func decodeNil(forKey key: Key) throws -> Bool {
|
||||
// We will decode nil if the key is not present.
|
||||
return !self.contains(key)
|
||||
!self.contains(key)
|
||||
}
|
||||
|
||||
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T : Decodable {
|
||||
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T: Decodable {
|
||||
try self.decoder.push(_StructuredHeaderCodingKey(key, keyDecodingStrategy: self.decoder.keyDecodingStrategy))
|
||||
defer {
|
||||
self.decoder.pop()
|
||||
|
||||
Reference in new issue
Block a user