Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move method implementations of HTMLString into StringProtocol. #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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