Expand description
string_more
is a Rust crate that enhances the String
and &str
types from the standard library with powerful extension traits: StringExt
and StrExt
.
These traits introduce additional methods to efficiently manipulate strings, focusing on minimizing allocations by allowing in-place modifications for String
and allocating when necessary for &str
.
StringExt
: Provides in-place operations for theString
type, modifying the string directly without creating a new allocation.StrExt
: Offers the same operations for&str
, but allocates and returns a newString
, leaving the original&str
intact.
§Features
- In-place Operations: Modify
String
values directly withStringExt
, minimizing memory allocations. - Immutable Operations: Use
StrExt
to perform operations on&str
that allocate and return new strings. - Flexible and Efficient: Designed to extend the standard string functionality without sacrificing performance.
Traits§
- Encode
Utf8 - The
EncodeUtf8
trait provides a consistent interface for encoding different text-like types, making them easily interchangeable as inputs for functions requiring UTF-8 encoded data. - StrExt
- The
StrExt
trait extends the standard library functionality for immutable string slices (&str
), providing advanced string manipulation utilities. - String
Ext - The
StringExt
trait extendsString
with advanced in-place manipulation methods, enabling modifications without creating newString
instances.