data String
Mutable string buffer (§3.2); freeze() turns it into str.
Example:
fn main() io {
var s = String.new()
for i in 1..=3 {
s.push("{i};")
}
print(s.freeze())
}Вывод
1;2;3;
@builtin("String") pub(api) data StringСложность. `push` is O(1) amortized.
С версии. 1.0.0-beta
Методы
new | () -> SelfEnds the building and returns the immutable str; the builder is consumed. |
len | () -> usizeThe number of bytes built so far. |
push | (s: str)Appends the text s. |
pushChar | (c: char)Appends one character. |
freeze | () -> strEnds the building and returns the immutable str; the builder is consumed. |
Определено в: std/core/types.oxl:80