From d5dd6283954e08a2d66b3050d8cc1944cc3a087c Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Thu, 17 Oct 2024 12:46:36 -0600 Subject: [PATCH] Make generic wrappers inlinable for specialization --- Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift | 1 + Sources/_StringProcessing/Regex/Match.swift | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift b/Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift index de0cabb0..b8fdd514 100644 --- a/Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift +++ b/Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift @@ -19,6 +19,7 @@ extension BidirectionalCollection where SubSequence == Substring { /// - Returns: The first match of `regex` in the collection, or `nil` if /// there isn't a match. @available(SwiftStdlib 5.7, *) + @inlinable public func firstMatch( of r: some RegexComponent ) -> Regex.Match? { diff --git a/Sources/_StringProcessing/Regex/Match.swift b/Sources/_StringProcessing/Regex/Match.swift index 3ade1f2f..c0a3aca3 100644 --- a/Sources/_StringProcessing/Regex/Match.swift +++ b/Sources/_StringProcessing/Regex/Match.swift @@ -303,6 +303,7 @@ extension BidirectionalCollection where SubSequence == Substring { /// - Parameter regex: The regular expression to match. /// - Returns: The match, if one is found. If there is no match, or a /// transformation in `regex` throws an error, this method returns `nil`. + @inlinable public func wholeMatch( of regex: R ) -> Regex.Match? { @@ -314,6 +315,7 @@ extension BidirectionalCollection where SubSequence == Substring { /// - Parameter regex: The regular expression to match. /// - Returns: The match, if one is found. If there is no match, or a /// transformation in `regex` throws an error, this method returns `nil`. + @inlinable public func prefixMatch( of regex: R ) -> Regex.Match? {