mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Tell Swift how to construct AK.StringView from string literals
This commit is contained in:
parent
a3e6856b56
commit
01c4625a42
Notes:
github-actions[bot]
2024-08-29 04:32:18 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/01c4625a421 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1220
1 changed files with 8 additions and 0 deletions
|
@ -22,3 +22,11 @@ extension Swift.String {
|
|||
self.init(data: data, encoding: .utf8)
|
||||
}
|
||||
}
|
||||
|
||||
extension AK.StringView: ExpressibleByStringLiteral {
|
||||
public typealias StringLiteralType = Swift.StaticString
|
||||
|
||||
public init(stringLiteral value: StringLiteralType) {
|
||||
self.init(value.utf8Start, value.utf8CodeUnitCount)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue