DecodableStreamSerializer
public struct DecodableStreamSerializer<T> : DataStreamSerializer where T : Decodable, T : Sendable
DataStreamSerializer which uses the provided DataPreprocessor and DataDecoder to serialize the incoming Data.
-
DataDecoderused to decode incomingData.Declaration
Swift
public let decoder: any DataDecoder -
DataPreprocessorincomingDatais passed through before being passed to theDataDecoder.Declaration
Swift
public let dataPreprocessor: any DataPreprocessor -
Creates an instance with the provided
DataDecoderandDataPreprocessor.Declaration
Swift
public init(decoder: any DataDecoder = JSONDecoder(), dataPreprocessor: any DataPreprocessor = PassthroughPreprocessor())Parameters
decoderDataDecoderused to decode incomingData.JSONDecoder()by default.dataPreprocessorDataPreprocessorused to process incomingDatabefore it’s passed through thedecoder.PassthroughPreprocessor()by default. -
Declaration
Swift
public func serialize(_ data: Data) throws -> T
View on GitHub
Install in Dash