mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09: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: 01c4625a42
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)
|
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…
Add table
Add a link
Reference in a new issue