dairy

A more compact, user friendly clone-on-write smart pointer.

```rust use std::path::Path; use dairy::Cow;

let borrowed: Cow = Cow::borrowed("Hello World!"); let owned: Cow = Cow::owned(String::from("Hello World!")); ```

Introduction

dairy::Cow is an improved version of the standard library std::borrow::Cow. It is just 2 words wide, storing the length, capacity, and the ownership tag all in one word. See tests/size.rs.

dairy::Cow has many more From and PartialEq implementations. Most notably for Cow<Path> making Into<Cow<Path>> just as nice to use as Cow<str>.

Unfortunately these benefits come with some caveats:

Getting started

Add the following to your Cargo manifest.

toml [dependencies] dairy = { version = "0.1", features = ["unix"] }

Acknowledgements

Some implementation details taken from the excellent beef crate.

License

Licensed under either of

at your option.