func decode()

in Sources/StructuredFieldValues/Decoder/BareItemDecoder.swift [127:164]


    func decode<T>(_ type: T.Type) throws -> T where T: Decodable {
        switch type {
        case is UInt8.Type:
            return try self.decode(UInt8.self) as! T
        case is Int8.Type:
            return try self.decode(Int8.self) as! T
        case is UInt16.Type:
            return try self.decode(UInt16.self) as! T
        case is Int16.Type:
            return try self.decode(Int16.self) as! T
        case is UInt32.Type:
            return try self.decode(UInt32.self) as! T
        case is Int32.Type:
            return try self.decode(Int32.self) as! T
        case is UInt64.Type:
            return try self.decode(UInt64.self) as! T
        case is Int64.Type:
            return try self.decode(Int64.self) as! T
        case is UInt.Type:
            return try self.decode(UInt.self) as! T
        case is Int.Type:
            return try self.decode(Int.self) as! T
        case is Float.Type:
            return try self.decode(Float.self) as! T
        case is Double.Type:
            return try self.decode(Double.self) as! T
        case is String.Type:
            return try self.decode(String.self) as! T
        case is Bool.Type:
            return try self.decode(Bool.self) as! T
        case is Data.Type:
            return try self.decode(Data.self) as! T
        case is Decimal.Type:
            return try self.decode(Decimal.self) as! T
        default:
            throw StructuredHeaderError.invalidTypeForItem
        }
    }