@@ -536,13 +536,20 @@ extension Span where Element: ~Copyable {
536536 /// - Complexity: O(1)
537537 @_alwaysEmitIntoClient
538538 @lifetime ( copy self)
539- public func _extracting ( _ bounds: Range < Index > ) -> Self {
539+ public func extracting ( _ bounds: Range < Index > ) -> Self {
540540 _precondition (
541541 UInt ( bitPattern: bounds. lowerBound) <= UInt ( bitPattern: _count) &&
542542 UInt ( bitPattern: bounds. upperBound) <= UInt ( bitPattern: _count) ,
543543 " Index range out of bounds "
544544 )
545- return unsafe _extracting( unchecked: bounds)
545+ return unsafe extracting( unchecked: bounds)
546+ }
547+
548+ @available ( * , deprecated, renamed: " extracting(_:) " )
549+ @_alwaysEmitIntoClient
550+ @lifetime ( copy self)
551+ public func _extracting( _ bounds: Range < Index > ) -> Self {
552+ extracting ( bounds)
546553 }
547554
548555 /// Constructs a new span over the items within the supplied range of
@@ -563,7 +570,7 @@ extension Span where Element: ~Copyable {
563570 @unsafe
564571 @_alwaysEmitIntoClient
565572 @lifetime ( copy self)
566- public func _extracting ( unchecked bounds: Range < Index > ) -> Self {
573+ public func extracting ( unchecked bounds: Range < Index > ) -> Self {
567574 let delta = bounds. lowerBound &* MemoryLayout< Element> . stride
568575 let newStart = unsafe _pointer? . advanced ( by: delta)
569576 let newSpan = unsafe Span( _unchecked: newStart, count: bounds. count)
@@ -572,6 +579,14 @@ extension Span where Element: ~Copyable {
572579 return unsafe _override Lifetime ( newSpan, copying: self )
573580 }
574581
582+ @unsafe
583+ @available ( * , deprecated, renamed: " extracting(unchecked:) " )
584+ @_alwaysEmitIntoClient
585+ @lifetime ( copy self)
586+ public func _extracting( unchecked bounds: Range < Index > ) -> Self {
587+ unsafe extracting( unchecked: bounds)
588+ }
589+
575590 /// Constructs a new span over the items within the supplied range of
576591 /// positions within this span.
577592 ///
@@ -587,10 +602,17 @@ extension Span where Element: ~Copyable {
587602 /// - Complexity: O(1)
588603 @_alwaysEmitIntoClient
589604 @lifetime ( copy self)
590- public func _extracting (
605+ public func extracting (
591606 _ bounds: some RangeExpression < Index >
592607 ) -> Self {
593- _extracting ( bounds. relative ( to: indices) )
608+ extracting ( bounds. relative ( to: indices) )
609+ }
610+
611+ @available ( * , deprecated, renamed: " extracting(_:) " )
612+ @_alwaysEmitIntoClient
613+ @lifetime ( copy self)
614+ public func _extracting( _ bounds: some RangeExpression < Index > ) -> Self {
615+ extracting ( bounds)
594616 }
595617
596618 /// Constructs a new span over the items within the supplied range of
@@ -611,13 +633,21 @@ extension Span where Element: ~Copyable {
611633 @unsafe
612634 @_alwaysEmitIntoClient
613635 @lifetime ( copy self)
614- public func _extracting (
636+ public func extracting (
615637 unchecked bounds: ClosedRange < Index >
616638 ) -> Self {
617639 let range = unsafe Range(
618640 _uncheckedBounds: ( bounds. lowerBound, bounds. upperBound + 1 )
619641 )
620- return unsafe _extracting( unchecked: range)
642+ return unsafe extracting( unchecked: range)
643+ }
644+
645+ @unsafe
646+ @available ( * , deprecated, renamed: " extracting(unchecked:) " )
647+ @_alwaysEmitIntoClient
648+ @lifetime ( copy self)
649+ public func _extracting( unchecked bounds: ClosedRange < Index > ) -> Self {
650+ unsafe extracting( unchecked: bounds)
621651 }
622652
623653 /// Constructs a new span over all the items of this span.
@@ -631,6 +661,13 @@ extension Span where Element: ~Copyable {
631661 /// - Complexity: O(1)
632662 @_alwaysEmitIntoClient
633663 @lifetime ( copy self)
664+ public func extracting( _: UnboundedRange ) -> Self {
665+ self
666+ }
667+
668+ @available ( * , deprecated, renamed: " extracting(_:) " )
669+ @_alwaysEmitIntoClient
670+ @lifetime ( copy self)
634671 public func _extracting( _: UnboundedRange ) -> Self {
635672 self
636673 }
@@ -761,13 +798,20 @@ extension Span where Element: ~Copyable {
761798 /// - Complexity: O(1)
762799 @_alwaysEmitIntoClient
763800 @lifetime ( copy self)
764- public func _extracting ( first maxLength: Int ) -> Self {
801+ public func extracting ( first maxLength: Int ) -> Self {
765802 _precondition ( maxLength >= 0 , " Can't have a prefix of negative length " )
766803 let newCount = min ( maxLength, count)
767804 let newSpan = unsafe Self( _unchecked: _pointer, count: newCount)
768805 return unsafe _override Lifetime ( newSpan, copying: self )
769806 }
770807
808+ @available ( * , deprecated, renamed: " extracting(first:) " )
809+ @_alwaysEmitIntoClient
810+ @lifetime ( copy self)
811+ public func _extracting( first maxLength: Int ) -> Self {
812+ extracting ( first: maxLength)
813+ }
814+
771815 /// Returns a span over all but the given number of trailing elements.
772816 ///
773817 /// If the number of elements to drop exceeds the number of elements in
@@ -784,13 +828,20 @@ extension Span where Element: ~Copyable {
784828 /// - Complexity: O(1)
785829 @_alwaysEmitIntoClient
786830 @lifetime ( copy self)
787- public func _extracting ( droppingLast k: Int ) -> Self {
831+ public func extracting ( droppingLast k: Int ) -> Self {
788832 _precondition ( k >= 0 , " Can't drop a negative number of elements " )
789833 let droppedCount = min ( k, count)
790834 let newSpan = unsafe Self( _unchecked: _pointer, count: count &- droppedCount)
791835 return unsafe _override Lifetime ( newSpan, copying: self )
792836 }
793837
838+ @available ( * , deprecated, renamed: " extracting(droppingLast:) " )
839+ @_alwaysEmitIntoClient
840+ @lifetime ( copy self)
841+ public func _extracting( droppingLast k: Int ) -> Self {
842+ extracting ( droppingLast: k)
843+ }
844+
794845 /// Returns a span containing the final elements of the span,
795846 /// up to the given maximum length.
796847 ///
@@ -808,7 +859,7 @@ extension Span where Element: ~Copyable {
808859 /// - Complexity: O(1)
809860 @_alwaysEmitIntoClient
810861 @lifetime ( copy self)
811- public func _extracting ( last maxLength: Int ) -> Self {
862+ public func extracting ( last maxLength: Int ) -> Self {
812863 _precondition ( maxLength >= 0 , " Can't have a suffix of negative length " )
813864 let newCount = min ( maxLength, count)
814865 let offset = ( count &- newCount) * MemoryLayout< Element> . stride
@@ -819,6 +870,13 @@ extension Span where Element: ~Copyable {
819870 return unsafe _override Lifetime ( newSpan, copying: self )
820871 }
821872
873+ @available ( * , deprecated, renamed: " extracting(last:) " )
874+ @_alwaysEmitIntoClient
875+ @lifetime ( copy self)
876+ public func _extracting( last maxLength: Int ) -> Self {
877+ extracting ( last: maxLength)
878+ }
879+
822880 /// Returns a span over all but the given number of initial elements.
823881 ///
824882 /// If the number of elements to drop exceeds the number of elements in
@@ -835,7 +893,7 @@ extension Span where Element: ~Copyable {
835893 /// - Complexity: O(1)
836894 @_alwaysEmitIntoClient
837895 @lifetime ( copy self)
838- public func _extracting ( droppingFirst k: Int ) -> Self {
896+ public func extracting ( droppingFirst k: Int ) -> Self {
839897 _precondition ( k >= 0 , " Can't drop a negative number of elements " )
840898 let droppedCount = min ( k, count)
841899 let offset = droppedCount &* MemoryLayout< Element> . stride
@@ -846,4 +904,11 @@ extension Span where Element: ~Copyable {
846904 // lifetime of 'buffer'. Make the dependence explicit.
847905 return unsafe _override Lifetime ( newSpan, copying: self )
848906 }
907+
908+ @available ( * , deprecated, renamed: " extracting(droppingFirst:) " )
909+ @_alwaysEmitIntoClient
910+ @lifetime ( copy self)
911+ public func _extracting( droppingFirst k: Int ) -> Self {
912+ extracting ( droppingFirst: k)
913+ }
849914}
0 commit comments