Str.reserve

This commit is contained in:
Folkert 2022-07-04 14:57:20 +02:00
parent f7b8094dfb
commit ab721dd3c1
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
10 changed files with 32 additions and 0 deletions

View file

@ -83,6 +83,7 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
STR_COUNT_GRAPHEMES => str_count_graphemes,
STR_COUNT_UTF8_BYTES => str_count_bytes,
STR_SUBSTRING_UNSAFE => str_substring_unsafe,
STR_RESERVE => str_reserve,
STR_FROM_UTF8 => str_from_utf8,
STR_FROM_UTF8_RANGE => str_from_utf8_range,
STR_TO_UTF8 => str_to_utf8,
@ -1737,6 +1738,11 @@ fn str_substring_unsafe(symbol: Symbol, var_store: &mut VarStore) -> Def {
lowlevel_3(symbol, LowLevel::StrSubstringUnsafe, var_store)
}
/// Str.reserve : Str, Nat -> Str
fn str_reserve(symbol: Symbol, var_store: &mut VarStore) -> Def {
lowlevel_2(symbol, LowLevel::StrReserve, var_store)
}
/// Str.fromUtf8 : List U8 -> Result Str [BadUtf8 { byteIndex : Nat, problem : Utf8Problem } }]*
fn str_from_utf8(symbol: Symbol, var_store: &mut VarStore) -> Def {
let bytes_var = var_store.fresh();