Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ version = "0.3.0"
rust-version = "1.73" # also change in ci.yml
authors = ["Laurenz <laurmaedje@gmail.com>"]
edition = "2021"
description = "Compact, clone-on-write vector and string."
description = "Compact, clone-on-write vector, string, and byte buffer."
repository = "https://github.com/typst/ecow"
readme = "README.md"
license = "MIT OR Apache-2.0"
categories = ["data-structures", "no-std"]
keywords = ["string", "vector", "sso", "cow"]
keywords = ["string", "vector", "bytes", "sso", "cow"]

[features]
default = ["std"]
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
[![Crates.io](https://img.shields.io/crates/v/ecow.svg)](https://crates.io/crates/ecow)
[![Documentation](https://docs.rs/ecow/badge.svg)](https://docs.rs/ecow)

Compact, clone-on-write vector and string.
Compact, clone-on-write vector, string, and byte buffer.

## Types
- An `EcoVec` is a reference-counted clone-on-write vector. It takes up two
words of space (= 2 usize) and has the same memory layout as a `&[T]` slice.
Within its allocation, it stores a reference count, its capacity and its
elements.

- An `EcoString` is a reference-counted clone-on-write string with inline
storage. It takes up 16 bytes of space. It has 15 bytes of inline storage and
starting from 16 bytes it becomes an `EcoVec<u8>`.
- `EcoVec` is a reference-counted clone-on-write vector. It takes up two words
of space (= 2 usize) and has the same memory layout as a `&[T]` slice. Within
its allocation, it stores a reference count, its capacity and its elements.

- `EcoString` is a reference-counted clone-on-write string with inline storage.
It takes up 16 bytes of space. It has 15 bytes of inline storage and starting
from 16 bytes it becomes an `EcoVec<u8>`.

- `EcoBytes` is a reference-counted clone-on-write byte buffer with inline
storage. Like an `EcoString`, it takes up 16 bytes and stores up to 15 bytes
inline before spilling to an `EcoVec<u8>`.

## Example
```rust
Expand Down
Loading
Loading