docs/Structs/DecodableStreamSerializer.html
public struct DecodableStreamSerializer<T> : DataStreamSerializer where T : Decodable, T : Sendable
DataStreamSerializer which uses the provided DataPreprocessor and DataDecoder to serialize the incoming Data.
`
decoder
`
DataDecoder used to decode incoming Data.
Swift
public let decoder: any DataDecoder
`
dataPreprocessor
`
DataPreprocessor incoming Data is passed through before being passed to the DataDecoder.
Swift
public let dataPreprocessor: any DataPreprocessor
`
init(decoder:dataPreprocessor:)
`
Creates an instance with the provided DataDecoder and DataPreprocessor.
Swift
public init(decoder: any DataDecoder = JSONDecoder(), dataPreprocessor: any DataPreprocessor = PassthroughPreprocessor())
| decoder |
DataDecoder used to decode incoming Data. JSONDecoder() by default.
|
| dataPreprocessor |
DataPreprocessor used to process incoming Data before it’s passed through the decoder. PassthroughPreprocessor() by default.
|
`
serialize(_:)
`
Swift
public func serialize(_ data: Data) throws -> T