A step solution built with stable rust
Go to file
Aode (Lion) 2e5d05deba
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Clippy
2022-01-13 20:39:01 -06:00
examples Dual license 2022-01-13 20:22:29 -06:00
src Clippy 2022-01-13 20:39:01 -06:00
stable-step-derive Dual license 2022-01-13 20:22:29 -06:00
.drone.yml Clippy 2022-01-13 20:39:01 -06:00
.gitignore Initial commit 2022-01-13 19:53:23 -06:00
Cargo.toml Clippy 2022-01-13 20:39:01 -06:00
LICENSE-APACHE Dual license 2022-01-13 20:22:29 -06:00
LICENSE-MIT Dual license 2022-01-13 20:22:29 -06:00
README.md Fix links 2022-01-13 20:24:40 -06:00

stable-step

steps in stable rust

Examples

No Dependencies

[dependencies]
stable-step = "0.1"
use stable_step::{Step, StepExt};

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
enum MyEnum {
    A,
    B,
}

impl Step for MyEnum {
    const MIN: Self = Self::A;
    const MAX: Self = Self::B;

    fn next(&self) -> Option<Self> {
        match self {
            Self::A => Some(Self::B),
            _ => None,
        }
    }

    fn prev(&self) -> Option<Self> {
        match self {
            Self::B => Some(Self::A),
            _ => None,
        }
    }
}

fn main() {
    for value in MyEnum::iter() {
        println!("{:?}", value);
    }
}

Proc Macros

[dependencies]
stable-step = { version = "0.1", features = ["derive"] }
use stable_step::{Step, StepExt};

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Step)]
enum MyEnum {
    A,
    B,
}

fn main() {
    for value in MyEnum::iter() {
        println!("{:?}", value);
    }
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.