Skip to content

[Rust] Fixed-capacity string #27

@awillenbuecher-xq-tec

Description

@awillenbuecher-xq-tec

We need a heap-allocated string which behaves similar to Rust's std::string::String, except that it reserves a fixed-capacity backing store on creation, and doesn't do any reallocations later on. This would be useful for cases where you only want to do memory allocations on startup, to avoid panics or aborts due to reallocations.

Criteria:

  • should share the majority of the logic with ABI-compatible string implementation
  • unlike the ABI-compatible string, the storage should be on the heap and not inline, so that moving the string is cheap
  • the capacity should be determined at runtime, not statically at compile-time
  • operations related to the string's capacity (like push, push_str, and pop) should be non-panicking and return a Result or Option instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions