Skip to content

Commit f793d84

Browse files
committed
Document niches
1 parent b635dde commit f793d84

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ pub mod examples;
143143
/// upper bound can be inclusive (`x..=y`) or exclusive (`x..y`). The attributes and visibility
144144
/// (e.g. `pub`) of the type are forwarded directly to the output type.
145145
///
146+
/// If the type is a struct and the bounded integer's range does not include zero,
147+
/// the struct will have a niche at zero,
148+
/// allowing for `Option<BoundedInteger>` to be the same size as `BoundedInteger` itself.
149+
///
146150
/// See the [`examples`] module for examples of what this macro generates.
147151
///
148152
/// # Examples

src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ macro_rules! define_bounded_integers {
690690
#[cfg_attr(doc_cfg, doc(cfg(feature = "step_trait")))]
691691
impl<const MIN: Inner, const MAX: Inner> iter::Step for Bounded<MIN, MAX> {
692692
#[inline]
693-
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
693+
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
694694
iter::Step::steps_between(&start.get(), &end.get())
695695
}
696696
#[inline]

0 commit comments

Comments
 (0)