polymorph 1.0.0

A few utilities to better enable polymorphic behavior in Rust.
Documentation

# Polymorph

[![crates.io version](https://img.shields.io/crates/v/polymorph)](https://crates.io/crates/polymorph)
[![apache2 license](https://img.shields.io/crates/l/polymorph)](https://www.gnu.org/licenses/license-recommendations.html)
[![docs.rs docs](https://img.shields.io/docsrs/polymorph)](https://docs.rs/polymorph)
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)

A set of utilities to better enable polymorphic behavior in Rust.

### Ref(Mut)OrOwned

`RefOrOwned<T>` is an enum over borrowed and owned data. It's similar to `std::borrow::Cow`. However, while Cow has a `ToOwned` requirement, RefOrOwned does not.

* There is also a `RefMutOrOwned` version, for when you need `&mut T`.
* `into_owned` is available where `T: Clone`.
* The type implements `From<&T>` and `From<T>`, as well as `Deref` to `T`

### Ref(Mut)OrBox

`RefOrBox<T>` is an enum over borrowed and boxed data, i.e. `&T` and `Box<T>`. It's intended for cases where T is unsized, like when T is a trait object.

* `RefMutOrBox` is a version of `RefOrBox` which uses `&mut T` and can be dereferenced to a mutable value.
* The type implements `From<&T>` and `From<T>`, as well as `Deref` to `T`.
* Optional support for the [dyn-clone]https://crates.io/crates/dyn-clone crate is provided by the **trait-clone** feature.  If `T: DynClone`, an `into_owned` method will be made available. More on this later.

### Safety

* The library contains no unsafe code
* The library should never panic

## Dependency

Add this library to your Cargo.toml:

```toml
[dependencies]
polymorph = "1.0"
```

### *trait-clone* feature

To enable interoperability with the **dyn-clone** trait, turn on this feature.

```toml
[dependencies]
polymorph = { version = "1.0", features = ["trait-clone"]}
```

This will add a `RefOrBox::into_owned` method which returns a `Box<T>`, either by returning the owned box or cloning a borrowed value.

### Other crates

Polymorph is well-combined with the `dyn-clone` and `enum-dispatch` crates for flexible and effective dynamic programming.

## License

Licensed under the Apache License v2.0. See the LICENSE.txt.