@@ -66,7 +66,7 @@ extension CSVWriter {
6666 /// - parameter configuration: Configuration values specifying how the CSV output should look like.
6767 /// - throws: `CSVError<CSVWriter>` exclusively.
6868 /// - returns: Data blob in a CSV format.
69- @inlinable public static func encode< S: Sequence , C: Collection > ( rows: S , configuration: Configuration = . init( ) ) throws -> Data where S. Element== C , C. Element== String {
69+ @inlinable public static func encode< S: Sequence , C: Collection > ( rows: S , into type : Data . Type , configuration: Configuration = . init( ) ) throws -> Data where S. Element== C , C. Element== String {
7070 let writer = try CSVWriter ( configuration: configuration)
7171 for row in rows {
7272 try writer. write ( row: row)
@@ -83,7 +83,7 @@ extension CSVWriter {
8383 /// - throws: `CSVError<CSVWriter>` exclusively.
8484 /// - returns: Swift `String` containing the formatted CSV data.
8585 @inlinable public static func encode< S: Sequence , C: Collection > ( rows: S , into type: String . Type , configuration: Configuration = . init( ) ) throws -> String where S. Element== C , C. Element== String {
86- let data = try CSVWriter . encode ( rows: rows, configuration: configuration)
86+ let data = try CSVWriter . encode ( rows: rows, into : Data . self , configuration: configuration)
8787 return String ( data: data, encoding: configuration. encoding ?? . utf8) !
8888 }
8989
@@ -111,10 +111,10 @@ extension CSVWriter {
111111 /// - parameter configuration: Default configuration values for the `CSVWriter`.
112112 /// - throws: `CSVError<CSVWriter>` exclusively.
113113 /// - returns: Data blob in a CSV format.
114- @inlinable public static func encode< S: Sequence , C: Collection > ( rows: S , setter: ( _ configuration: inout Configuration ) -> Void ) throws -> Data where S. Element== C , C. Element== String {
114+ @inlinable public static func encode< S: Sequence , C: Collection > ( rows: S , into type : Data . Type , setter: ( _ configuration: inout Configuration ) -> Void ) throws -> Data where S. Element== C , C. Element== String {
115115 var configuration = Configuration ( )
116116 setter ( & configuration)
117- return try CSVWriter . encode ( rows: rows, configuration: configuration)
117+ return try CSVWriter . encode ( rows: rows, into : type , configuration: configuration)
118118 }
119119
120120
@@ -167,9 +167,9 @@ fileprivate extension CSVWriter.Error {
167167// MARK: - Deprecations
168168
169169extension CSVWriter {
170- @available ( * , deprecated, renamed: " encode(rows:configuration:) " )
170+ @available ( * , deprecated, renamed: " encode(rows:into: configuration:) " )
171171 public static func serialize< S: Sequence , C: Collection > ( rows: S , configuration: Configuration = . init( ) ) throws -> Data where S. Element== C , C. Element== String {
172- try self . encode ( rows: rows, configuration: configuration)
172+ try self . encode ( rows: rows, into : Data . self , configuration: configuration)
173173 }
174174
175175 @available ( * , deprecated, renamed: " encode(rows:into:configuration:) " )
@@ -182,9 +182,9 @@ extension CSVWriter {
182182 try self . encode ( rows: rows, into: fileURL, append: append, configuration: configuration)
183183 }
184184
185- @available ( * , deprecated, renamed: " encode(rows:setter:) " )
185+ @available ( * , deprecated, renamed: " encode(rows:into: setter:) " )
186186 public static func serialize< S: Sequence , C: Collection > ( rows: S , setter: ( _ configuration: inout Configuration ) -> Void ) throws -> Data where S. Element== C , C. Element== String {
187- try self . encode ( rows: rows, setter: setter)
187+ try self . encode ( rows: rows, into : Data . self , setter: setter)
188188 }
189189
190190 @available ( * , deprecated, renamed: " encode(rows:into:setter:) " )
0 commit comments