Skip to content

Conversation

es-kumagai
Copy link

When we get a substring value from a String value (using .prefix, .suffix, subscript and so on), we can get the value in Substring type. The Substring type provide a way to access the substring value without copying the part of string from original value. So, to use Substring value directly, we can use the substring more efficiently.

For that reason, I tried to move the method implementations of HTMLString from String type to StringProtocol protocol. The StringProtocol is conformed to both String type and Substring type. So, to implementing the methods by StringProtocol instead of String, the methods will belong both String and Substring. This allows us to use HTMLString methods by Substring directly without copying the part of content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant