Butcher
An easy way to interact with Cow
ed structs and enums.
This crate proposes some simple solutions to the most common patterns I met
while working with Cow
s in Rust. It currently fixes two patterns:
destructuring and iteration related to objects wrapped in Cow
.
Destructuring
The Butcher
trait can be used when it is necessary to destruture something
wrapped in a Cow
. Below is a simple example:
use Cow;
use Butcher;
The Butcher
procedural macro can be derived for structs
and for enums.
Iteration
Here is a demonstration of how to iterate over an object wrapped in a Cow
:
use Cow;
use ;
See the documentation of CowIter
for more information.