Skip to content

Commit

Permalink
Merge branch 'feature/hashable-document' into master/6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis committed Mar 14, 2019
2 parents 037eebd + 20b8480 commit d8d74b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/BSON/Document/Document+Equatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ extension Document: Equatable {
return lhs.makeData() == rhs.makeData()
}
}

extension Document: Hashable {
public func hash(into hasher: inout Hasher) {
self.makeByteBuffer().withUnsafeReadableBytes { buffer in
hasher.combine(bytes: buffer)
}
}
}

0 comments on commit d8d74b7

Please sign in to comment.