Skip to content

MessagePackDecoder

mattt edited this page Apr 24, 2021 · 1 revision

MessagePackDecoder

An object that decodes instances of a data type from MessagePack objects.

final public class MessagePackDecoder

Inheritance

TopLevelDecoder

Nested Type Aliases

Input

canImport(Combine)
public typealias Input = Data

Initializers

init()

public init()

Properties

userInfo

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

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

nonMatchingFloatDecodingStrategy

The strategy used by a decoder when it encounters format mismatches for floating point values.

var nonMatchingFloatDecodingStrategy: NonMatchingFloatDecodingStrategy = .strict

Methods

decode(_:from:)

Returns a value of the type you specify, decoded from a MessagePack object.

public func decode<T>(_ type: T.Type, from data: Data) throws -> T where T: Decodable

Parameters

  • type: The type of the value to decode from the supplied MessagePack object.
  • data: The MessagePack object to decode.

Throws

DecodingError.dataCorrupted(_:​) if the data is not valid MessagePack.