Skip to main content

appstr

Function appstr 

Source
pub fn appstr(base: &mut String, append: &str)
Expand description

Port of appstr(char *base, char const *append) from Src/string.c:186.

C body:

return strcat(realloc(base, strlen(base) + strlen(append) + 1),
              append);

C reallocates base (which may move) and returns the new pointer. Rust’s &mut String mutates in place; the equivalent of C’s “return the new pointer” is “the caller’s reference is still valid after the push” — String::push_str reallocates transparently if needed.