setJSONEncodable(_:encoder:at:)

Encodes value using the JSONEncoder encoder and set the resulting bytes into this ByteBuffer at the given index.

Codable+ByteBuffer.swift:79
@discardableResult mutating func setJSONEncodable<T>(_ value: T, encoder: JSONEncoder = JSONEncoder(), at index: Int) throws -> Int where T : Encodable

Parameters

value

An Encodable value to encode.

encoder

The JSONEncoder to encode value with.

index

The starting index of the bytes for the value into the ByteBuffer.

Returns

The number of bytes written.