Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

MessagePackEncoder

mattt edited this page Apr 24, 2021 · 1 revision

MessagePackEncoder

An object that encodes instances of a data type as MessagePack objects.

final public class MessagePackEncoder

Inheritance

TopLevelEncoder

Nested Type Aliases

Input

canImport(Combine)
public typealias Input = Data

Initializers

init()

public init()

Properties

userInfo

A dictionary you use to customize the encoding process by providing contextual information.

var userInfo: [CodingUserInfoKey : Any] = [:]

Methods

encode(_:)

Returns a MessagePack-encoded representation of the value you supply.

public func encode<T>(_ value: T) throws -> Data where T: Encodable

Parameters

  • value: The value to encode as MessagePack.

Throws

EncodingError.invalidValue(_:​_:​) if the value can't be encoded as a MessagePack object.