Initializer (Default implementation)swift-bson 0.3.1BSONDecoding

init(bson:)

Attempts to cast the given variant value to a string, and then delegates to this type’s init(_:) witness.

BSONStringDecodable.swift:32
init(bson: BSON.UTF8View<ArraySlice<UInt8>>) throws

This default implementation is provided on an extension on a dedicated protocol rather than an extension on BSONDecodable itself to prevent unexpected behavior for types (such as Double) who implement LosslessStringConvertible, but expect to be decoded from a variant value that is not a string.