[][src]Crate butcher


An easy way to interact with Cowed structs and enums.

This crate proposes some simple solutions to the most common patterns I met while working with Cows in Rust. It currently fixes the iteration pattern. Other patterns will be added in a near future.


Here is a demonstration of how to iterate over an object wrapped in a Cow:

use std::borrow::Cow;
use butcher::iterator::{CowIter, IntoCowIterator};

fn print_numbers(elems: Cow<[u32]>) {
    let mut iter = elems.into_cow_iter();

    for element in iter {
        // The type of element is Cow<u32>
        println!("{:?}", element);

See the documentation of CowIter for more information.



An iterator over data wrapped in Cow.