AK: Tell Swift how to construct AK.StringView from string literals

This commit is contained in:
Andrew Kaster 2024-08-28 21:22:05 -06:00 committed by Andreas Kling
parent a3e6856b56
commit 01c4625a42
Notes: github-actions[bot] 2024-08-29 04:32:18 +00:00

View file

@ -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)
}
}