libluna: Add String::from_string_view()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
53ec448e33
commit
376247ba8a
@ -41,7 +41,7 @@ Result<int> luna_main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto str = TRY(String::from_cstring(pathname.chars()));
|
auto str = TRY(String::from_string_view(pathname));
|
||||||
TRY(files.try_append(move(str)));
|
TRY(files.try_append(move(str)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ class String
|
|||||||
static Result<String> vformat(StringView fmt, va_list ap);
|
static Result<String> vformat(StringView fmt, va_list ap);
|
||||||
|
|
||||||
static Result<String> from_cstring(const char* str);
|
static Result<String> from_cstring(const char* str);
|
||||||
|
static Result<String> from_string_view(StringView str)
|
||||||
|
{
|
||||||
|
return from_cstring(str.chars());
|
||||||
|
}
|
||||||
|
|
||||||
const char* chars() const
|
const char* chars() const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user