Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move method implementations of HTMLString into StringProtocol.#35

Open
es-kumagai wants to merge 1 commit into
alexaubry:main from
es-kumagai:SubstringSupport
Open

Move method implementations of HTMLString into StringProtocol. #35
es-kumagai wants to merge 1 commit into
alexaubry:main from
es-kumagai:SubstringSupport

Conversation

@es-kumagai

@es-kumagai es-kumagai commented Mar 1, 2021

Copy link
Copy Markdown

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /