#small #str #string

no-std smallstr

String-like container based on smallvec

3 releases (breaking)

0.3.0 Mar 12, 2022
0.2.0 Jan 17, 2020
0.1.0 Apr 26, 2018

#337 in Data structures

Download history 8713/week @ 2023-10-16 9885/week @ 2023-10-23 8930/week @ 2023-10-30 9352/week @ 2023-11-06 10468/week @ 2023-11-13 10131/week @ 2023-11-20 10788/week @ 2023-11-27 14978/week @ 2023-12-04 10182/week @ 2023-12-11 10502/week @ 2023-12-18 6289/week @ 2023-12-25 8503/week @ 2024-01-01 9747/week @ 2024-01-08 11957/week @ 2024-01-15 11655/week @ 2024-01-22 12403/week @ 2024-01-29

46,363 downloads per month
Used in 141 crates (26 directly)

MIT/Apache

33KB
792 lines

smallstr

String-like container based on SmallVec

Documentation

Building

To include smallstr in your project, add the following to your Cargo.toml:

[dependencies]
smallstr = "0.3"

License

smallstr is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.


lib.rs:

Implements SmallString, a String-like container for small strings

no_std support

By default, smallstr does not depend on std. The std feature may be enabled to add the std dependency. The ffi feature also implies std.

ffi feature

The ffi feature will add the following trait implementations to SmallString:

  • PartialEq<OsStr>
  • PartialEq<&'_ OsStr>
  • PartialEq<OsString>
  • PartialEq<Cow<'_, OsString>>

This feature also adds std as a dependency.

serde support

When the serde feature is enabled, the traits serde::Deserialize and serde::Serialize are implemented for SmallString.

This feature is disabled by default.

By default, the serde dependency is compiled with no_std. If the std feature is enabled, std is added as a dependency in serde, as well.

union feature

This feature will enable the union feature in smallvec, which reduces the size of a SmallString instance. This feature requires a nightly compiler.

Dependencies

~54–250KB