Skip to content

Commit

Permalink
Added support for number and float decoding strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitribouniol committed Jun 3, 2021
1 parent fafc16a commit 5d831ef
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 112 deletions.
4 changes: 2 additions & 2 deletions Sources/DynamicCodable/CoderInternals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension DynamicCodable {
}

@inline(__always)
func unwrap<T>(errorHandler: () throws -> Never) rethrows -> T {
func unwrap<T>(errorHandler: () throws -> T) rethrows -> T {
switch T.self {
case is Keyed.Type: if case .keyed(let keyed) = self { return unsafeBitCast(keyed, to: T.self) }
case is Unkeyed.Type: if case .unkeyed(let unkeyed) = self { return unsafeBitCast(unkeyed, to: T.self) }
Expand All @@ -93,6 +93,6 @@ extension DynamicCodable {
default: break // TODO: We should do something different here, so we can ignore this case in the caller. Perhaps return a specialized error?
}

try errorHandler()
return try errorHandler()
}
}
Loading

0 comments on commit 5d831ef

Please sign in to comment.