StatefulEncoder
public protocol StatefulEncoder : StatefulCoder
An object that flattens values into a serialized Encoding, maintaining state across the
serialization of individual parts.
Note
this protocol matches Foundation’sXXXEncoder types, which—confusingly—do not
themselves conform to the Encoder protocol.
-
Returns a serialized representation of
subject.Declaration
Swift
func encode<T>(_ subject: T) throws -> Encoding where T : Encodable -
encode(_:Extension methodstartState: ) Returns a serialized representation of
subject, usingstartStateas the initial encoding state.Declaration
Swift
public mutating func encode<T, State: Sendable>(_ value: T, startState: State) throws -> Encoding where T: Encodable
View on GitHub