@@ -1413,3 +1413,36 @@ extension _StringGuts {
1413
1413
return UnsafeMutablePointer ( mutating: _unmanagedUTF16View. start)
1414
1414
}
1415
1415
}
1416
+
1417
+ extension _StringGuts {
1418
+ @available ( * , deprecated)
1419
+ public // SPI(Foundation)
1420
+ var _isContiguousASCII : Bool {
1421
+ return _object. isContiguousASCII
1422
+ }
1423
+
1424
+ @available ( * , deprecated)
1425
+ public // SPI(Foundation)
1426
+ var _isContiguousUTF16 : Bool {
1427
+ return _object. isContiguousUTF16
1428
+ }
1429
+
1430
+ @available ( * , deprecated)
1431
+ public // SPI(Foundation)
1432
+ func _withUnsafeUTF8CodeUnitsIfAvailable< Result> (
1433
+ _ f: ( UnsafeBufferPointer < UInt8 > ) throws -> Result
1434
+ ) rethrows -> Result ? {
1435
+ guard _object. isContiguousASCII else { return nil }
1436
+ return try f ( _unmanagedASCIIView. buffer)
1437
+ }
1438
+
1439
+ @available ( * , deprecated)
1440
+ public // SPI(Foundation)
1441
+ func _withUnsafeUTF16CodeUnitsIfAvailable< Result> (
1442
+ _ f: ( UnsafeBufferPointer < UInt16 > ) throws -> Result
1443
+ ) rethrows -> Result ? {
1444
+ guard _object. isContiguousUTF16 else { return nil }
1445
+ return try f ( _unmanagedUTF16View. buffer)
1446
+ }
1447
+ }
1448
+
0 commit comments