Skip to content

Commit

Permalink
Remove redundent decode funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAlgorithm committed Jun 11, 2022
1 parent a534dd8 commit fd8dcd7
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions Sources/ETFKit/Decoder/SingleValueDecode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,10 @@ extension _ETFDecoder: SingleValueDecodingContainer {
decoded == nil
}

func decode(_ type: Bool.Type) throws -> Bool {
guard let val = decoded as? Bool else {
throw DecodingError.typeMismatch(Bool.self, .init(codingPath: codingPath, debugDescription: ""))
}
return val
}

func decode(_ type: String.Type) throws -> String {
guard let val = decoded as? String else {
throw DecodingError.typeMismatch(String.self, .init(codingPath: codingPath, debugDescription: ""))
}
return val
}

func decode(_ type: Double.Type) throws -> Double {
guard let val = decoded as? Double else {
throw DecodingError.typeMismatch(Double.self, .init(codingPath: codingPath, debugDescription: ""))
}
return val
}

func decode(_ type: Float.Type) throws -> Float {
Float(try decode(Double.self))
}

func decode(_ type: Int.Type) throws -> Int {
guard let val = decoded as? Int else {
throw DecodingError.typeMismatch(Int.self, .init(codingPath: codingPath, debugDescription: ""))
}
return val
}

func decode(_ type: Int8.Type) throws -> Int8 {
Int8(try decode(Int.self))
}
Expand Down

0 comments on commit fd8dcd7

Please sign in to comment.