You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you clone() a String, you have to allocate new memory and copy the contents of the string over. Whereas when you clone() an ImString, you're just incrementing a reference count, but not duplicating the data. The data inside an ImString can be cheaply shared.
The difference between an ImString and a &str is that you cannot easily store a &str in, say, a struct or a hashmap and pass it around. It has a lifetime attached to it. Since you cannot have self-referential structs, you cannot have, say a struct that contains a String and a bunch of string slices (&str) pointing to it. That is what this crate solves: you can use an ImString like a &str, but it does not need a lifetime.
Hey, seems like all the features in this library can be achieved via the use of rust string and &str slice. So anything I missed? Thx.
The text was updated successfully, but these errors were encountered: