ordinal
The last three bytes of this identifier. The first tuple element is the byte at offset +9 of this identifier.
var ordinal: Ordinal { get }
The last three bytes of this identifier. The first tuple element is the byte at offset +9 of this identifier.
var ordinal: Ordinal { get }
import BSONABI
Models the BSON type system and the binary interface of the BSON serialization format.
@frozen struct Identifier
A MongoDB object reference. This type models a MongoDB ObjectId
.
@frozen enum BSON
The namespace for all BSON types.
typealias Ordinal = (UInt8, UInt8, UInt8)
init(_ high: UInt32, _ middle: UInt32, _ low: UInt32)
Creates an identifier with the given high-, middle-, and low-components. The components are interpreted by platform endianness; therefore the values stored into bitPattern
may be different if the current host is not big-endian.
init(integerLiteral: StaticBigInt)
init(timestamp: UInt32, seed: Seed, ordinal: Ordinal)
init(with initialize: (_ memory: UnsafeMutableRawBufferPointer) throws -> ()) rethrows
Creates an identifier by delegating to the closure to initialize raw memory. The buffer contains 12 bytes and will be interpreted as a 96-bit, big-endian integer.
let bitPattern: (UInt32, UInt32, UInt32)
var description: String { get }
var low: UInt32 { get }
The low 32 bits of this identifier. The high byte of this integer is the byte at offset +8 of this identifier.
var middle: UInt32 { get }
The middle 32 bits of this identifier. The high byte of this integer is the byte at offset +4 of this identifier.
var seed: Seed { get }
The middle five bytes of this identifier. The first tuple element is the byte at offset +4 of this identifier.
var timestamp: UInt32 { get }
The high 32 bits of this identifier. The high byte of this integer is the byte at offset +0 of this identifier.
static func < (lhs: `Self`, rhs: `Self`) -> Bool
Compares the bytes of this identifier in lexicographical order. This is the same as performing a lexicographic numeric comparison on (timestamp
, middle
, low
). Depending on platform endianness, this may be different from performing a lexicographic numeric comparison on bitPattern
directly.
static func == (lhs: `Self`, rhs: `Self`) -> Bool
func hash(into hasher: inout Hasher)
Hashes the bytes of this identifier in the order they are stored in memory.
typealias Seed = (UInt8, UInt8, UInt8, UInt8, UInt8)