Creates a lazily unfolded representation for some BSON. Because of the mutability of bytes
and this laziness, set the copy parameter to true
if you are not sure that the bytes
will not be mutated in the future.
By default, conforming
is false
, so that any value can be serialized, including immediates (see bson
).
By default, cache
is true
, so a future serialization of the same data will be faster. The input bytes are stored in the value. You may want to turn this off if these values have a long lifespan, and that you care more about memory consumption than serialization speed.
By default, laziness
is true
. If the data is a serialized object, it means that only the field names are read, the field values are eluded, and will be deserialized on demand when calling Repr.view
. This implies that Bson_decoding_error
may be raised later. If set to false
, the whole structure is decoded upfront, so any decoding error will happen at this point. This may be preferable mostly when reading from untusted sources.
May raise Bson_decoding_error
.