expected(_:)
Creates an InputError
with appropriate context for the specified expectation.
func expected(_ expectation: BSON.InputError.Expectation) -> BSON.InputError
Creates an InputError
with appropriate context for the specified expectation.
func expected(_ expectation: BSON.InputError.Expectation) -> BSON.InputError
s7BSONABI4BSONO5InputV8expectedyAC0C5ErrorVAH11ExpectationOF
What are these?95GO0
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.
@frozen struct InputError
A parser did not receive the expected amount of input.
@frozen enum Expectation
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 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<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<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.