parse(as:)
Parses a traversable BSON element. The output is typically opaque, which allows decoders to skip over regions of a BSON document.
mutating func parse<View>(as _: View.Type = View.self) throws -> View where View : BSON.BufferTraversable
Parses a traversable BSON element. The output is typically opaque, which allows decoders to skip over regions of a BSON document.
mutating func parse<View>(as _: View.Type = View.self) throws -> View where View : BSON.BufferTraversable
s7BSONABI4BSONO5InputV5parse2asxxm_tKAC17BufferTraversableRzlF
What are these?97R3H
import BSONABI
Models the BSON type system and the binary interface of the BSON serialization format.
@frozen struct Input
A type for managing BSON parsing state. Most users of this module should not need to interact with it directly.
@frozen enum BSON
The namespace for all BSON types.
protocol BufferTraversable
A framed type that BSON parsers can traverse in constant time.
init(_ source: ArraySlice<UInt8>)
Creates a parsing input view over the given source
data, and initializes its index
to the start index of the source
.
var index: Int
var remaining: ArraySlice<UInt8> { get }
Returns a slice of the input from the current index
to the end of the input. Accessing this property does not affect the current index
.
let source: ArraySlice<UInt8>
func expected(_ expectation: BSON.InputError.Expectation) -> BSON.InputError
Creates an InputError
with appropriate context for the specified expectation.
func finish() throws
Asserts that there is no input remaining.
mutating func next() -> UInt8?
Consumes and returns a single byte from this parsing input.
mutating func parse<Frame>(_: Frame.Type) throws -> ArraySlice<UInt8> where Frame : BSON.BufferFrameType
mutating func parse(as _: UnixMillisecond.Type = UnixMillisecond.self) throws -> UnixMillisecond
mutating func parse(as _: BSON.Decimal128.Type = BSON.Decimal128.self) throws -> BSON.Decimal128
mutating func parse(as _: BSON.Identifier.Type = BSON.Identifier.self) throws -> BSON.Identifier
Parses a MongoDB object identifier.
mutating func parse(as _: BSON.Regex.Type = BSON.Regex.self) throws -> BSON.Regex
mutating func parse(as _: String.Type = String.self) throws -> String
Parses a null-terminated string.
mutating func parse(as _: Bool.Type = Bool.self) throws -> Bool
Parses a boolean.
mutating func parse<LittleEndian>(as _: LittleEndian.Type = LittleEndian.self) throws -> LittleEndian where LittleEndian : FixedWidthInteger
Parses a little-endian integer.
@discardableResult mutating func parse(through byte: UInt8) throws -> Range<Int>
Advances the current index until encountering the specified byte
. After this method returns, index
points to the byte after the matched byte.
mutating func parse(variant: BSON.AnyType) throws -> BSON.AnyValue
Parses a variant BSON value, assuming it is of the specified variant
type.