[][src]Crate pluralize

  • The Pluralize trait exists to offer a single generic trait which can yield an iterator from any reference. This allows generic code to be implemented where the plurality of the generic type is flexible. This is accomplished by casting the reference of any single primitive into a single element array of the same type and calling the appropriate .iter() function.

  • In simplest terms if you specify that a generic type has the bounds Pluralize< T > then that type could be a plain old T or a Vec<T>. In order to make use of this simply call the .puralize( ) method and iterate in a for loop.

  • Features

  • This crate is fully compatible with #![no_std] projects, just include a default-features=false directive along with the dependency information in your Cargo.toml

  • Limitations

  • This approach does have some limitations you should be aware of.
    More complex collections which don't use the std::slice:: family of iterators aren't supported.
    Currently, after the creation of a vector behind a Pluralize binding there is no way to grow that vector, it can only be modified using .pluralize_mut( ) which isn't capable of doing anything other than modifying preexisting elements.

Macros

impl_primitive_pluralize

Traits

Pluralize

A trait implemented across both collections and single primitives which exposes an iterator