Binary
public struct Binary : BSONValue, Equatable, Codable, Hashable
A struct to represent the BSON Binary type.
-
The binary data.
Declaration
Swift
public let data: Data
-
The binary subtype for this data.
Declaration
Swift
public let subtype: UInt8
-
Subtypes for BSON Binary values.
See moreDeclaration
Swift
public enum Subtype : UInt8
-
Initializes a
Binary
instance from aUUID
.Throws
InvalidArgumentError
if aBinary
cannot be constructed from this UUID.
Declaration
Swift
public init(from uuid: UUID) throws
-
Initializes a
Binary
instance from aData
object and aUInt8
subtype.Throws
InvalidArgumentError
if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(data: Data, subtype: UInt8) throws
-
Initializes a
Binary
instance from aData
object and aSubtype
.Throws
InvalidArgumentError
if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(data: Data, subtype: Subtype) throws
-
Initializes a
Binary
instance from a base64String
and aUInt8
subtype.Throws
InvalidArgumentError
if the base64String
is invalid or if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(base64: String, subtype: UInt8) throws
-
Initializes a
Binary
instance from a base64String
and aSubtype
.Throws
InvalidArgumentError
if the base64String
is invalid or if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(base64: String, subtype: Subtype) throws
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to: Encoder) throws