bounded_integer/
examples.rs

1//! Examples of bounded integers generated by the [`bounded_integer!`] macro.
2//!
3//! This module is not present when using the crate.
4
5use crate::bounded_integer;
6
7bounded_integer! {
8    /// A bounded struct, implemented as a protected newtype.
9    ///
10    /// This was generated from:
11    /// ```
12    #[cfg_attr(feature = "step_trait", doc = "# #![feature(step_trait)]")]
13    /// # use bounded_integer::bounded_integer;
14    /// bounded_integer! {
15    ///     pub struct BoundedStruct(-8, 7);
16    /// }
17    /// ```
18    pub struct BoundedStruct(-8, 7);
19}
20
21bounded_integer! {
22    /// A bounded enum.
23    ///
24    /// This was generated from:
25    /// ```
26    #[cfg_attr(feature = "step_trait", doc = "# #![feature(step_trait)]")]
27    /// # use bounded_integer::bounded_integer;
28    /// bounded_integer! {
29    ///     pub enum BoundedEnum(-8, 7);
30    /// }
31    /// ```
32    pub enum BoundedEnum(-8, 7);
33}
34
35bounded_integer! {
36    /// A bounded enum with named variants.
37    ///
38    /// This was generated from:
39    /// ```
40    #[cfg_attr(feature = "step_trait", doc = "# #![feature(step_trait)]")]
41    /// # use bounded_integer::bounded_integer;
42    /// bounded_integer! {
43    ///     pub enum BoundedEnumNamed {
44    ///         Zero,
45    ///         One,
46    ///         Two,
47    ///     }
48    /// }
49    /// ```
50    pub enum BoundedEnumNamed {
51        Zero,
52        One,
53        Two,
54    }
55}