12 releases (breaking)

Uses new Rust 2021

0.9.0 Nov 16, 2022
0.8.1 Oct 10, 2022

#653 in Rust patterns

Download history 182/week @ 2022-09-28 102/week @ 2022-10-05 17/week @ 2022-10-12 10/week @ 2022-10-19 3/week @ 2022-10-26 33/week @ 2022-11-02 2/week @ 2022-11-09 35/week @ 2022-11-16 3/week @ 2022-11-23

73 downloads per month

MIT/Apache

31KB
704 lines

This library defines strings with copy-on-write semantics.

CowStr

Is a String that can be initialized to a static string or be build dynamically. Its contents can then be immutably shared. When mutation is required the string will be copied first.

CowStr implements many of the std::String methods. Missing methods will be added as required, PR's are welcome.

SubStr

Refers to a (immutable) span inside a CowStr.

Features

  • singlethreaded uses a simpler Cell based reference counter. Default is an atomic reference counter. When in in doubt keep the default, esp for libraries, atomics on x86 have no performance impact. The 'singlethreaded' variant should only be used for applications that are designed to be single threaded and shall run on architectures where atomics are more expensive.

No runtime deps

Features

  • singlethreaded