Module exhaust::impls

source ·
Expand description

Implementations of Exhaust for standard library types.

The public contents of this module are just the corresponding structs implementing Iterator. These need to be public, but should mostly be considered an implementation detail and not need to be used explicitly.

The following primitive or standard library types do not implement Exhaust for particular reasons:

  • References, because there’s nowhere to stash the referent. (This could be changed for small finite types, like &bool, but those are the same sort of types which are unlikely to be used by reference.)
  • Pointers, for the same reason as references (and we could generate invalid pointers, but that would be almost certainly pointless).
  • u64, i64, and f64, because they are too large to feasibly exhaust.
  • core::cell::UnsafeCell, because it does not implement Clone.
  • core::mem::ManuallyDrop, because it would be a memory leak.
  • core::mem::MaybeUninit, because it is not useful to obtain a MaybeUninit<T> value without knowing whether it is initialized, and if they are to be all initialized, then T::exhaust() is just as good.
  • alloc::vec::Vec and other collections that permit duplicate items, since their possible values are bounded only by available memory.
  • std::io::ErrorKind and other explicitly non-exhaustive types.
  • std::io::Stdout and other types whose sole use is in performing IO.
  • std::sync::Mutex and RwLock, which do not implement Clone.

Structs