@@ -391,60 +391,70 @@ extension String {
391
391
extension Scanner {
392
392
393
393
// On overflow, the below methods will return success and clamp
394
+ @discardableResult
394
395
public func scanInt32( _ result: UnsafeMutablePointer < Int32 > ) -> Bool {
395
396
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int32 ) -> Void in
396
397
result. pointee = value
397
398
}
398
399
}
399
400
401
+ @discardableResult
400
402
public func scanInt( _ result: UnsafeMutablePointer < Int > ) -> Bool {
401
403
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int ) -> Void in
402
404
result. pointee = value
403
405
}
404
406
}
405
407
408
+ @discardableResult
406
409
public func scanInt64( _ result: UnsafeMutablePointer < Int64 > ) -> Bool {
407
410
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int64 ) -> Void in
408
411
result. pointee = value
409
412
}
410
413
}
411
414
415
+ @discardableResult
412
416
public func scanUnsignedLongLong( _ result: UnsafeMutablePointer < UInt64 > ) -> Bool {
413
417
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt64 ) -> Void in
414
418
result. pointee = value
415
419
}
416
420
}
417
421
422
+ @discardableResult
418
423
public func scanFloat( _ result: UnsafeMutablePointer < Float > ) -> Bool {
419
424
return _scanString. scan ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Float ) -> Void in
420
425
result. pointee = value
421
426
}
422
427
}
423
428
429
+ @discardableResult
424
430
public func scanDouble( _ result: UnsafeMutablePointer < Double > ) -> Bool {
425
431
return _scanString. scan ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Double ) -> Void in
426
432
result. pointee = value
427
433
}
428
434
}
429
435
436
+ @discardableResult
430
437
public func scanHexInt32( _ result: UnsafeMutablePointer < UInt32 > ) -> Bool {
431
438
return _scanString. scanHex ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt32 ) -> Void in
432
439
result. pointee = value
433
440
}
434
441
}
435
442
443
+ @discardableResult
436
444
public func scanHexInt64( _ result: UnsafeMutablePointer < UInt64 > ) -> Bool {
437
445
return _scanString. scanHex ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt64 ) -> Void in
438
446
result. pointee = value
439
447
}
440
448
}
441
449
450
+ @discardableResult
442
451
public func scanHexFloat( _ result: UnsafeMutablePointer < Float > ) -> Bool {
443
452
return _scanString. scanHex ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Float ) -> Void in
444
453
result. pointee = value
445
454
}
446
455
}
447
456
457
+ @discardableResult
448
458
public func scanHexDouble( _ result: UnsafeMutablePointer < Double > ) -> Bool {
449
459
return _scanString. scanHex ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Double ) -> Void in
450
460
result. pointee = value
@@ -579,6 +589,7 @@ extension Scanner {
579
589
}
580
590
}
581
591
592
+ @discardableString
582
593
public func scanString( _ string: String , into ptr: UnsafeMutablePointer < String ? > ? ) -> Bool {
583
594
if let str = scanString ( string) {
584
595
ptr? . pointee = str
@@ -652,6 +663,7 @@ extension Scanner {
652
663
return nil
653
664
}
654
665
666
+ @discardableResult
655
667
public func scanUpToCharacters( from set: CharacterSet , into ptr: UnsafeMutablePointer < String ? > ? ) -> Bool {
656
668
if let result = scanUpToCharactersFromSet ( set) {
657
669
ptr? . pointee = result
0 commit comments