MCPcopy Index your code
hub / github.com/cobalt-org/kstring

github.com/cobalt-org/kstring @v2.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.2 ↗ · + Follow
127 symbols 216 edges 10 files 2 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

KString

Key String: Optimized for map keys.

Crates Status

Background

Considerations: - Large maps - Most keys live and drop without being used in any other way - Most keys are relatively small (single to double digit bytes) - Keys are immutable - Allow zero-cost abstractions between structs and maps (e.g. no allocating when dealing with struct field names)

Ramifications: - Inline small strings rather than going to the heap. - Preserve &'static str across strings (KString), references (KStringRef), and lifetime abstractions (KStringCow) to avoid allocating for struct field names. - Use Box<str> rather than String to use less memory.

Features - max_inline: Instead of aligning the inline-string for performance (15 bytes + length on 64-bit), use the full width (22 bytes on 64-bit) - arc: Instead of using Box<str>, use Arc<str>. Note: allocations are fast enough that this can actually slow things down for small enough strings.

Alternatives, see string-benchmarks-rs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

HeapStr (Interface)
Abstract over different type of heap-allocated strings [3 implementers]
src/backend.rs
Sealed (Interface)
(no doc) [3 implementers]
src/backend.rs

Core symbols most depended-on inside this repo

as_str
called by 28
src/string.rs
as_str
called by 21
src/stack.rs
as_str
called by 16
src/string_ref.rs
as_str
called by 16
src/string_cow.rs
len
called by 13
src/stack.rs
clone
called by 11
src/string.rs
is_empty
called by 10
src/stack.rs
is_owned
called by 7
src/string.rs

Shape

Method 100
Class 13
Function 9
Enum 3
Interface 2

Languages

Rust100%

Modules by API surface

src/string.rs45 symbols
src/string_cow.rs26 symbols
src/stack.rs23 symbols
src/string_ref.rs21 symbols
src/backend.rs6 symbols
tests/string.rs2 symbols
src/lib.rs1 symbols
examples/bench.rs1 symbols
benches/clone.rs1 symbols
benches/access.rs1 symbols

For agents

$ claude mcp add kstring \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact