#string #dst #stack

str_stack

A string allocator for allocating many write-once strings. This library is primarily useful for parsing where you need to repeatedly build many strings, use them, and then throw them away. Instead of allocating many independent strings, this library will put them all in the same buffer.

1 unstable release

Uses old Rust 2015

0.1.0 Nov 14, 2015

#6 in #dst

Download history 15940/week @ 2021-09-28 40723/week @ 2021-10-05 33651/week @ 2021-10-12 21656/week @ 2021-10-19 21839/week @ 2021-10-26 21205/week @ 2021-11-02 21822/week @ 2021-11-09 16470/week @ 2021-11-16 12639/week @ 2021-11-23 21613/week @ 2021-11-30 27740/week @ 2021-12-07 27275/week @ 2021-12-14 21660/week @ 2021-12-21 18256/week @ 2021-12-28 27782/week @ 2022-01-04 29326/week @ 2022-01-11

101,635 downloads per month
Used in 69 crates (2 directly)

MIT/Apache

11KB
255 lines

StrStack

Linux: Build Status

A string allocation library. This is primarily useful when you want to allocate a bunch of small strings, use them, and then destroy them all together.

Documentation

https://stebalien.github.com/str_stack/str_stack/

Performance

  • Allocation: ~2.5x speedup (for 1000 strings) (~42ns per string)
  • Indexing: 0.73x speedup (slower) (~1.7ns per index)
  • Iterate: 0.35x speedup (much slower) (~1ns per iteration)

lib.rs:

A string allocation library. This is primarily useful when you want to allocate a bunch of small strings, use them, and then destroy them all together.

Example

use str_stack::StrStack;

let mut stack = StrStack::new();
let first = stack.push("one");
let second = stack.push("two");
let third = stack.push("three");

assert_eq!(&stack[first], "one");
assert_eq!(&stack[second], "two");
assert_eq!(&stack[third], "three");

No runtime deps

ZGV