@@ -419,60 +419,70 @@ extension String {
419
419
extension Scanner {
420
420
421
421
// On overflow, the below methods will return success and clamp
422
+ @discardableResult
422
423
public func scanInt32( _ result: UnsafeMutablePointer < Int32 > ) -> Bool {
423
424
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int32 ) -> Void in
424
425
result. pointee = value
425
426
}
426
427
}
427
428
429
+ @discardableResult
428
430
public func scanInt( _ result: UnsafeMutablePointer < Int > ) -> Bool {
429
431
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int ) -> Void in
430
432
result. pointee = value
431
433
}
432
434
}
433
435
436
+ @discardableResult
434
437
public func scanInt64( _ result: UnsafeMutablePointer < Int64 > ) -> Bool {
435
438
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: Int64 ) -> Void in
436
439
result. pointee = value
437
440
}
438
441
}
439
442
443
+ @discardableResult
440
444
public func scanUnsignedLongLong( _ result: UnsafeMutablePointer < UInt64 > ) -> Bool {
441
445
return _scanString. scan ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt64 ) -> Void in
442
446
result. pointee = value
443
447
}
444
448
}
445
449
450
+ @discardableResult
446
451
public func scanFloat( _ result: UnsafeMutablePointer < Float > ) -> Bool {
447
452
return _scanString. scan ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Float ) -> Void in
448
453
result. pointee = value
449
454
}
450
455
}
451
456
457
+ @discardableResult
452
458
public func scanDouble( _ result: UnsafeMutablePointer < Double > ) -> Bool {
453
459
return _scanString. scan ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Double ) -> Void in
454
460
result. pointee = value
455
461
}
456
462
}
457
463
464
+ @discardableResult
458
465
public func scanHexInt32( _ result: UnsafeMutablePointer < UInt32 > ) -> Bool {
459
466
return _scanString. scanHex ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt32 ) -> Void in
460
467
result. pointee = value
461
468
}
462
469
}
463
470
471
+ @discardableResult
464
472
public func scanHexInt64( _ result: UnsafeMutablePointer < UInt64 > ) -> Bool {
465
473
return _scanString. scanHex ( _skipSet, locationToScanFrom: & _scanLocation) { ( value: UInt64 ) -> Void in
466
474
result. pointee = value
467
475
}
468
476
}
469
477
478
+ @discardableResult
470
479
public func scanHexFloat( _ result: UnsafeMutablePointer < Float > ) -> Bool {
471
480
return _scanString. scanHex ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Float ) -> Void in
472
481
result. pointee = value
473
482
}
474
483
}
475
484
485
+ @discardableResult
476
486
public func scanHexDouble( _ result: UnsafeMutablePointer < Double > ) -> Bool {
477
487
return _scanString. scanHex ( _skipSet, locale: locale, locationToScanFrom: & _scanLocation) { ( value: Double ) -> Void in
478
488
result. pointee = value
@@ -607,6 +617,7 @@ extension Scanner {
607
617
}
608
618
}
609
619
620
+ @discardableResult
610
621
public func scanString( _ string: String , into ptr: UnsafeMutablePointer < String ? > ? ) -> Bool {
611
622
if let str = scanString ( string) {
612
623
ptr? . pointee = str
@@ -680,6 +691,7 @@ extension Scanner {
680
691
return nil
681
692
}
682
693
694
+ @discardableResult
683
695
public func scanUpToCharacters( from set: CharacterSet , into ptr: UnsafeMutablePointer < String ? > ? ) -> Bool {
684
696
if let result = scanUpToCharactersFromSet ( set) {
685
697
ptr? . pointee = result
0 commit comments