fitzgen / inlinable_string

An owned, grow-able UTF-8 string that stores small strings inline and avoids heap-allocation.
http://fitzgen.github.io/inlinable_string/inlinable_string/index.html
Other
69 stars 11 forks source link

Consider arrayvec::ArrayString's trick for making the inline size generic #2

Open fitzgen opened 8 years ago

fitzgen commented 8 years ago

From https://www.reddit.com/r/rust/comments/3v2uzv/inlinable_string_a_dropin_replacement_for/cxjwhvx:

Nice. There's a more generic version for the inline part called ArrayString in crate arrayvec (contributed by @tbu- !); it's generic over a set of backing sizes. Feel free to copy the array-parametrization approach.

My original fear was that this would break StringExt from being object safe, but I see now that the InlineString impl(s) and not the StringExt trait would use this so there is nothing to worry about.

fitzgen commented 8 years ago

http://bluss.github.io/arrayvec/doc/arrayvec/struct.ArrayString.html

https://crates.io/crates/arrayvec