enum-iterator-0.6.0/Cargo.toml.orig010064400017500001750000000010031362257506200154220ustar0000000000000000[package] name = "enum-iterator" version = "0.6.0" authors = ["Stephane Raux "] edition = "2018" description = "Tools to iterate over the variants of a field-less enum" license = "MIT" homepage = "https://github.com/stephaneyfx/enum-iterator" repository = "https://github.com/stephaneyfx/enum-iterator.git" documentation = "https://docs.rs/enum-iterator" keywords = ["enum", "variants", "iterator"] [dependencies] enum-iterator-derive = {path = "../enum-iterator-derive", version = "0.6.0"} enum-iterator-0.6.0/Cargo.toml0000644000000017511362257554000117430ustar00# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] edition = "2018" name = "enum-iterator" version = "0.6.0" authors = ["Stephane Raux "] description = "Tools to iterate over the variants of a field-less enum" homepage = "https://github.com/stephaneyfx/enum-iterator" documentation = "https://docs.rs/enum-iterator" keywords = ["enum", "variants", "iterator"] license = "MIT" repository = "https://github.com/stephaneyfx/enum-iterator.git" [dependencies.enum-iterator-derive] version = "0.6.0" enum-iterator-0.6.0/src/lib.rs010064400017500001750000000024641362257462300144540ustar0000000000000000// Copyright (C) 2018-2019 Stephane Raux. Distributed under the MIT license. //! Tools to iterate over the variants of a field-less enum. //! //! See the `IntoEnumIterator` trait. #![deny(missing_docs)] #![deny(warnings)] #![no_std] pub use enum_iterator_derive::IntoEnumIterator; use core::iter; /// Trait to iterate over the variants of a field-less enum. /// /// Field-less (a.k.a. C-like) enums are enums whose variants don't have additional data. /// /// This trait is meant to be derived. /// /// # Example /// /// ``` /// use enum_iterator::IntoEnumIterator; /// /// #[derive(Clone, IntoEnumIterator, PartialEq)] /// enum Direction {North, South, West, East} /// /// fn main() { /// assert_eq!(Direction::VARIANT_COUNT, 4); /// assert!(Direction::into_enum_iter().eq([Direction::North, /// Direction::South, Direction::West, Direction::East].iter() /// .cloned())); /// } /// ``` pub trait IntoEnumIterator: Sized { /// Type of the iterator over the variants. type Iterator: Iterator + iter::ExactSizeIterator + iter::FusedIterator + Copy; /// Number of variants. const VARIANT_COUNT: usize; /// Returns an iterator over the variants. /// /// Variants are yielded in the order they are defined in the enum. fn into_enum_iter() -> Self::Iterator; } enum-iterator-0.6.0/.cargo_vcs_info.json0000644000000001121362257554000137330ustar00{ "git": { "sha1": "293f7b84794341bf873d84d3654c3cda0441d594" } }