mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Revise comments per proposed revisions to SE-0163
This commit is contained in:
@@ -18,7 +18,11 @@ public protocol _UnicodeEncoding {
|
||||
associatedtype EncodedScalar : BidirectionalCollection
|
||||
where EncodedScalar.Iterator.Element == CodeUnit
|
||||
|
||||
/// The replacement character U+FFFD as represented in this encoding
|
||||
/// A unicode scalar value to be used when repairing
|
||||
/// encoding/decoding errors, as represented in this encoding.
|
||||
///
|
||||
/// If the Unicode replacement character U+FFFD is representable in this
|
||||
/// encoding, `encodedReplacementCharacter` encodes that scalar value.
|
||||
static var encodedReplacementCharacter : EncodedScalar { get }
|
||||
|
||||
/// Converts from encoded to encoding-independent representation
|
||||
@@ -30,13 +34,23 @@ public protocol _UnicodeEncoding {
|
||||
|
||||
/// Converts a scalar from another encoding's representation, returning
|
||||
/// `nil` if the scalar can't be represented in this encoding.
|
||||
///
|
||||
/// A default implementation of this method will be provided
|
||||
/// automatically for any conforming type that does not implement one.
|
||||
static func transcode<FromEncoding : UnicodeEncoding>(
|
||||
_ content: FromEncoding.EncodedScalar, from _: FromEncoding.Type
|
||||
) -> EncodedScalar?
|
||||
|
||||
/// A type that can be used to parse `CodeUnits` into
|
||||
/// `EncodedScalar`s.
|
||||
associatedtype ForwardParser : UnicodeParser
|
||||
associatedtype ReverseParser : UnicodeParser
|
||||
// where ForwardParser.Encoding == Self
|
||||
|
||||
/// A type that can be used to parse a reversed sequence of
|
||||
/// `CodeUnits` into `EncodedScalar`s.
|
||||
associatedtype ReverseParser : UnicodeParser
|
||||
// where ReverseParser.Encoding == Self
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// FIXME: this requirement shouldn't be here and is mitigated by the default
|
||||
// implementation below. Compiler bugs prevent it from being expressed in an
|
||||
|
||||
Reference in New Issue
Block a user