typst / ecow

Compact, clone-on-write vector and string.
Apache License 2.0
205 stars 16 forks source link

Make `EcoVec` generic over choice of reference count type #32

Closed Kmeakin closed 1 year ago

Kmeakin commented 1 year ago

This patch adds a reference count type parameter to EcoVec<T>, allowing it to be used with non-atomic reference counts if the vec is only being used on a single thread.

I left EcoString non-generic over refence counts, but that could also be made generic in a future patch.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage is 56.60% of modified lines.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Changed Coverage
src/refcount.rs 46.87%
src/vec.rs 62.50%
src/dynamic.rs 100.00%

:loudspeaker: Thoughts on this report? Let us know!.

laurmaedje commented 1 year ago

This idea has come up before and my thoughts are quite well expressed by this comment on a similar PR to smol_str: https://github.com/rust-analyzer/smol_str/pull/37#issuecomment-925902011

laurmaedje commented 1 year ago

See also discussion on the reddit post: https://www.reddit.com/r/rust/comments/117ksvr/comment/j9ek5t3/

Kmeakin commented 1 year ago

This idea has come up before and my thoughts are quite well expressed by this comment on a similar PR to smol_str: https://github.com/rust-analyzer/smol_str/pull/37#issuecomment-925902011

That's a shame but I understand the design decision