@@ -304,18 +304,22 @@ public final class StreamClass {
304
304
self . buffer = [ ]
305
305
}
306
306
307
+ @inline ( __always)
307
308
public func write( _ byte: UInt8 ) {
308
309
buffer. append ( byte)
309
310
}
310
311
312
+ @inline ( __always)
311
313
public func write( _ value: WriteProt ) {
312
314
value. writeTo ( self )
313
315
}
314
316
317
+ @inline ( __always)
315
318
public func writeEscaped( _ string: String ) {
316
319
writeEscaped ( string: string. utf8)
317
320
}
318
321
322
+ @inline ( __always)
319
323
public func writeEscaped< T: Collection > (
320
324
string sequence: T
321
325
) where T. Iterator. Element == UInt8 {
@@ -326,12 +330,14 @@ public final class StreamClass {
326
330
}
327
331
}
328
332
333
+ @inline ( __always)
329
334
public func toStream( _ stream: StreamClass , _ value: WriteProt ) -> StreamClass {
330
335
stream. write ( value)
331
336
return stream
332
337
}
333
338
334
339
extension UInt8 : WriteProt {
340
+ @inline ( __always)
335
341
public func writeTo( _ stream: StreamClass ) {
336
342
stream. write ( self )
337
343
}
@@ -344,6 +350,7 @@ public func asWriteProt(_ string: String) -> WriteProt {
344
350
private struct EscapedString : WriteProt {
345
351
let value : String
346
352
353
+ @inline ( __always)
347
354
func writeTo( _ stream: StreamClass ) {
348
355
_ = toStream ( stream, UInt8 ( ascii: " a " ) )
349
356
stream. writeEscaped ( value)
@@ -359,6 +366,7 @@ private struct EscapedTransforme<T>: WriteProt {
359
366
let items : [ T ]
360
367
let transform : ( T ) -> String
361
368
369
+ @inline ( __always)
362
370
func writeTo( _ stream: StreamClass ) {
363
371
for (i, item) in items. enumerated ( ) {
364
372
if i != 0 { _ = toStream ( stream, asWriteProt ( transform ( item) ) ) }
@@ -388,6 +396,6 @@ public func run_MergeTest9(_ N: Int) {
388
396
let listOfThings : [ Thing ] = listOfStrings. map ( Thing . init)
389
397
for _ in 1 ... N {
390
398
let stream = StreamClass ( )
391
- _ = toStream ( stream, asWriteProt ( listOfThings, transform: { $0. value } ) )
399
+ _ = toStream ( stream, asWriteProt ( listOfThings, transform: { $0. value } ) )
392
400
}
393
401
}
0 commit comments