Conversation

So. Rust. I need an array of strings. The array must be dynamically growable at runtime. The strings are not known until runtime, but once known are immutable. If they are removed from the vector they should be freed. I said: static mut root:Vec<str> = Vec(); It did NOT like it
Image
5
12
Am I - On the right track, I just initialized that empty vector wrong - On the wrong track, str is compile time only, I should use String for this - Technically on the right track, I could do this with str, but I should just do it with String because it's totes efficient enough
14
8
`Vec<String>` is what you want. `String` is a dynamically allocated string on the heap - kind of like `StringBuilder` in Java. `str` is unicode data of unknown size - but you usually see it behind a reference: `&str`. On it's own it's not usually super useful for most people.
1
1
Show replies