encode(_:)
Encodes the given value.
mutating func encode(_ value: Int8) throws
Parameters
- value
The value to encode.
Throws
EncodingError.invalidValue
if the given value is invalid in the current context for this format.
Encodes the given value.
mutating func encode(_ value: Int8) throws
The value to encode.
EncodingError.invalidValue
if the given value is invalid in the current context for this format.
import Swift
protocol UnkeyedEncodingContainer
A type that provides a view into an encoder’s storage and is used to hold the encoded properties of an encodable type sequentially, without keys.
@frozen struct Int8
An 8-bit signed integer value type.
var codingPath: [any CodingKey] { get }
The path of coding keys taken to get to this point in encoding.
var count: Int { get }
The number of elements encoded into the container.
mutating func encode(_ value: String) throws
Encodes the given value.
mutating func encode(_ value: Bool) throws
Encodes the given value.
mutating func encode(_ value: Double) throws
Encodes the given value.
mutating func encode(_ value: Float) throws
Encodes the given value.
mutating func encode(_ value: Int) throws
Encodes the given value.
mutating func encode(_ value: UInt) throws
Encodes the given value.
mutating func encode<T>(_ value: T) throws where T : Encodable
Encodes the given value.
mutating func encode(_ value: Int16) throws
Encodes the given value.
mutating func encode(_ value: Int32) throws
Encodes the given value.
mutating func encode(_ value: Int64) throws
Encodes the given value.
mutating func encode(_ value: UInt8) throws
Encodes the given value.
mutating func encode(_ value: Int128) throws
Encodes the given value.
mutating func encode(_ value: UInt16) throws
Encodes the given value.
mutating func encode(_ value: UInt32) throws
Encodes the given value.
mutating func encode(_ value: UInt64) throws
Encodes the given value.
mutating func encode(_ value: UInt128) throws
Encodes the given value.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element : Encodable
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == String
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Bool
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Double
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Float
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int8
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int16
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int32
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int64
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt8
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == Int128
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt16
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt32
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt64
Encodes the elements of the given sequence.
mutating func encode<T>(contentsOf sequence: T) throws where T : Sequence, T.Element == UInt128
Encodes the elements of the given sequence.
mutating func encodeConditional<T>(_ object: T) throws where T : AnyObject, T : Encodable
Encodes a reference to the given object only if it is encoded unconditionally elsewhere in the payload (previously, or in the future).
mutating func encodeNil() throws
Encodes a null value.
mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
Encodes a nested container keyed by the given type and returns it.
mutating func nestedUnkeyedContainer() -> any UnkeyedEncodingContainer
Encodes an unkeyed encoding container and returns it.
mutating func superEncoder() -> any Encoder
Encodes a nested container and returns an Encoder
instance for encoding super
into that container.
mutating func encode(_ value: Int128) throws
mutating func encode(_ value: UInt128) throws