Skip to content

Commit

Permalink
Merge pull request #77 from orlandos-nl/feature/jo-fast-bsondecoder
Browse files Browse the repository at this point in the history
Implement a simpler but faster BSONDecoder for use by MongoKitten
  • Loading branch information
Joannis committed Mar 13, 2023
2 parents e28af5a + 8b54dd0 commit 6157fa9
Show file tree
Hide file tree
Showing 9 changed files with 978 additions and 81 deletions.
8 changes: 8 additions & 0 deletions Sources/BSON/Codable/Decoding/BSONDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ extension BSONDecoderSettings.IntegerDecodingStrategy {
}

/// Decodes the `value` without key to an integer of type `I` using the current strategy
@_specialize(where I == UInt8)
@_specialize(where I == Int8)
@_specialize(where I == UInt16)
@_specialize(where I == Int16)
@_specialize(where I == UInt32)
@_specialize(where I == Int32)
@_specialize(where I == UInt)
@_specialize(where I == Int)
internal func decode(
from decoder: _BSONDecoder,
path: @autoclosure () -> [String]
Expand Down
4 changes: 2 additions & 2 deletions Sources/BSON/Codable/Decoding/BSONDecoderSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ public struct BSONDecoderSettings {
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
public var decodeObjectIdFromString: Bool = false

/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
public var decodeDateFromTimestamp: Bool = false
/// If `true`, allows decoding Date from a Double (TimeInterval)
public var decodeDateFromTimestamp: Bool = true

/// A strategy that is applied when encountering a request to decode a `Float`
public var floatDecodingStrategy: FloatDecodingStrategy
Expand Down

0 comments on commit 6157fa9

Please sign in to comment.