@@ -81,23 +81,27 @@ extension TextOutputStream {
81
81
82
82
/// A source of text-streaming operations.
83
83
///
84
- /// Instances of types that conform to the `Streamable` protocol can write
85
- /// their value to instances of any type that conforms to the `TextOutputStream`
86
- /// protocol. The Swift standard library's text-related types, `String`,
87
- /// `Character`, and `UnicodeScalar`, all conform to `Streamable`.
84
+ /// Instances of types that conform to the `TextOutputStreamable` protocol can
85
+ /// write their value to instances of any type that conforms to the
86
+ /// `TextOutputStream` protocol. The Swift standard library's text-related
87
+ /// types, `String`, `Character`, and `UnicodeScalar`, all conform to
88
+ /// `TextOutputStreamable`.
88
89
///
89
- /// Conforming to the Streamable Protocol
90
+ /// Conforming to the TextOutputStreamable Protocol
90
91
/// =====================================
91
92
///
92
- /// To add `Streamable ` conformance to a custom type, implement the required
93
- /// `write(to:)` method. Call the given output stream's `write(_:)` method in
94
- /// your implementation.
95
- public protocol Streamable {
93
+ /// To add `TextOutputStreamable ` conformance to a custom type, implement the
94
+ /// required `write(to:)` method. Call the given output stream's `write(_:)`
95
+ /// method in your implementation.
96
+ public protocol TextOutputStreamable {
96
97
/// Writes a textual representation of this instance into the given output
97
98
/// stream.
98
99
func write< Target : TextOutputStream > ( to target: inout Target )
99
100
}
100
101
102
+ // @available(*, unavailable, renamed: "TextOutputStreamable")
103
+ public typealias Streamable = TextOutputStreamable
104
+
101
105
/// A type with a customized textual representation.
102
106
///
103
107
/// Types that conform to the `CustomStringConvertible` protocol can provide
@@ -346,7 +350,7 @@ internal func _print_unlocked<T, TargetStream : TextOutputStream>(
346
350
debugPrintable. debugDescription. write ( to: & target)
347
351
return
348
352
}
349
- if case let streamableObject as Streamable = value {
353
+ if case let streamableObject as TextOutputStreamable = value {
350
354
streamableObject. write ( to: & target)
351
355
return
352
356
}
@@ -373,7 +377,7 @@ internal func _print_unlocked<T, TargetStream : TextOutputStream>(
373
377
/// This function is forbidden from being inlined because when building the
374
378
/// standard library inlining makes us drop the special semantics.
375
379
@inline ( never) @effects ( readonly)
376
- func _toStringReadOnlyStreamable< T : Streamable > ( _ x: T ) -> String {
380
+ func _toStringReadOnlyStreamable< T : TextOutputStreamable > ( _ x: T ) -> String {
377
381
var result = " "
378
382
x. write ( to: & result)
379
383
return result
@@ -402,7 +406,7 @@ public func _debugPrint_unlocked<T, TargetStream : TextOutputStream>(
402
406
return
403
407
}
404
408
405
- if let streamableObject = value as? Streamable {
409
+ if let streamableObject = value as? TextOutputStreamable {
406
410
streamableObject. write ( to: & target)
407
411
return
408
412
}
@@ -415,7 +419,8 @@ internal func _dumpPrint_unlocked<T, TargetStream : TextOutputStream>(
415
419
_ value: T , _ mirror: Mirror , _ target: inout TargetStream
416
420
) {
417
421
if let displayStyle = mirror. displayStyle {
418
- // Containers and tuples are always displayed in terms of their element count
422
+ // Containers and tuples are always displayed in terms of their element
423
+ // count
419
424
switch displayStyle {
420
425
case . tuple:
421
426
let count = mirror. children. count
@@ -448,7 +453,7 @@ internal func _dumpPrint_unlocked<T, TargetStream : TextOutputStream>(
448
453
return
449
454
}
450
455
451
- if let streamableObject = value as? Streamable {
456
+ if let streamableObject = value as? TextOutputStreamable {
452
457
streamableObject. write ( to: & target)
453
458
return
454
459
}
@@ -519,7 +524,7 @@ extension String : TextOutputStream {
519
524
// Streamables
520
525
//===----------------------------------------------------------------------===//
521
526
522
- extension String : Streamable {
527
+ extension String : TextOutputStreamable {
523
528
/// Writes the string into the given output stream.
524
529
///
525
530
/// - Parameter target: An output stream.
@@ -528,7 +533,7 @@ extension String : Streamable {
528
533
}
529
534
}
530
535
531
- extension Character : Streamable {
536
+ extension Character : TextOutputStreamable {
532
537
/// Writes the character into the given output stream.
533
538
///
534
539
/// - Parameter target: An output stream.
@@ -537,7 +542,7 @@ extension Character : Streamable {
537
542
}
538
543
}
539
544
540
- extension UnicodeScalar : Streamable {
545
+ extension UnicodeScalar : TextOutputStreamable {
541
546
/// Writes the textual representation of the Unicode scalar into the given
542
547
/// output stream.
543
548
///
@@ -568,7 +573,7 @@ internal struct _TeeStream<
568
573
@available ( * , unavailable, renamed: " TextOutputStream " )
569
574
public typealias OutputStreamType = TextOutputStream
570
575
571
- extension Streamable {
576
+ extension TextOutputStreamable {
572
577
@available ( * , unavailable, renamed: " write(to:) " )
573
578
public func writeTo< Target : TextOutputStream > ( _ target: inout Target ) {
574
579
Builtin . unreachable ( )
0 commit comments