Instance Methodswift-mongodb 0.27.0BSONABI
reserve(another:)
Reserves another bytes
worth of capacity in the output destination, in addition to the bytes already present.
mutating func reserve(another bytes: Int)
Other members in extension
Type members
init(capacity: Int
) Create an empty output, reserving enough space for the specified number of bytes in the destination buffer.
init(preallocated: ArraySlice<UInt8>
) Create an output with a pre-allocated destination buffer. The buffer does not need to be empty, and existing data will not be cleared.
Instance members
var destination: ArraySlice<UInt8>
subscript<Encoder>(as: Encoder.Type
) -> Encoder Temporarily rebinds this output’s storage buffer to an encoder of the specified type. This function does not add any headers or trailers; to emit a complete BSON frame, mutate through
subscript(as:in:)
.subscript<Encoder>(as: Encoder.Type, in: BSON.DocumentFrame.Type
) -> Encoder Temporarily rebinds this output’s storage buffer to an encoder of the specified type, bracketing it with the appropriate headers or trailers.
subscript(with: BSON.Key
) -> BSON.FieldEncoder Temporarily rebinds this output’s storage buffer to a field encoder. Field encoding is always lazy, so the getter has no effects.
func append(UInt8
) Appends a single byte to the output destination.
func append(some Sequence<UInt8>
) Appends a sequence of bytes to the output destination.
func serialize(fields: some Sequence<(key: BSON.Key, value: BSON.AnyValue)>
) func serialize(id: BSON.Identifier
) func serialize(key: BSON.Key, value: BSON.AnyValue
) Serializes the raw type code of the given variant value, followed by the field key (with a trailing null byte), followed by the variant value itself.
func serialize(type: BSON.AnyType
) func serialize(variant: BSON.AnyValue
) Serializes the given variant value, without encoding its type.