rust_book_art 0.1.1

Crate from Chapter 14 Section 2 of the Rust book, demonstrating `pub use` and crate publishing.
Documentation
//! # Art
//!
//! A library for modelling artistic concepts. (Actually, it's just for learning about
//! using `pub use` to re-export items in order to present a more convenient public API,
//! providing a more convenient alternative to a crate user than the internal hierarchy.)
//!
//! This is from Chapter 14 Section 2 of the Rust book.
//!
//! ## Re-exporting items
//!
//! A crate that depends on this library could write something like this:
//! ```
//! use rust_book_art::kinds::PrimaryColour;
//! use rust_book_art::utils::mix;
//!
//! fn main() {
//!     let red = PrimaryColour::Red;
//!     let yellow = PrimaryColour::Yellow;
//!     mix(red, yellow);
//! }
//! ```
//! This would required the user of the `art` crate to figure out that colours are in the `kinds`
//! module and `mix` is in the `utils` module. That hierarchy is more useful to someone developing
//! the `art` crate than someone just using it in their own project.
//!
//! Using the re-exports, a crate user could write this instead:
//! ```
//! use rust_book_art::PrimaryColour;
//! use rust_book_art::mix;
//!
//! fn main() {
//!     // --snip--
//! }
//! ```
//! Re-exporting deeply nested modules and decoupling internal structure from what the user sees
//! can improve the user's experience, and allows flexibility in the internal structure of the crate
//! code.
//!
//! ## Publishing crates
//!
//! Another reason for this crate is so I can learn about publishing to crates.io.
//!
//! First, make a [crates.io](https://crates.io) account and get an API token from crates.io/me, then run `cargo login
//! <token>`. The token is saved in *~/.cargo/credentials*.

pub use self::kinds::PrimaryColour;
pub use self::kinds::SecondaryColour;
pub use self::utils::mix;

pub mod kinds {
    pub enum PrimaryColour {
        Red,
        Yellow,
        Blue
    }

    pub enum SecondaryColour {
        Orange,
        Green,
        Purple,
    }
}

pub mod utils {
    use crate::kinds::*;

    #[allow(unused)]
    pub fn mix(c1: PrimaryColour, c2: PrimaryColour) -> SecondaryColour {
        SecondaryColour::Orange
    }
}