Cell<T>
implementsExhaust
even whenT
does not implementCopy
.- Documentation contains examples for the
Exhaust
derive macro anditeration::carry
.
- The macro-generated types are now always named
Exhaust<your type name><some suffix>
. This makes it possible to reliably avoid name conflicts in the narrow case that they can happen, and is more systematic than the previous naming scheme. - Explicitly
allow(nonstandard_style)
in macro generated code. Together with the above name change, this should prevent lint from the macro-generated code when using rust-analyzer.
The Exhaust
trait no longer requires Self: Clone
.
This allows it to be implemented for many more types, such as Mutex
and Atomic*
,
which can be constructed with arbitrary data but not cloned.
In order to support this, the Exhaust
trait now separates iteration over the possible data
(which still must be cloneable) from construction of the final value.
The new definition of the trait is:
pub trait Exhaust: Sized {
type Iter: FusedIterator<Item = Self::Factory> + Clone;
type Factory: Clone; // New
// Required methods
fn exhaust_factories() -> Self::Iter; // New
fn from_factory(factory: Self::Factory) -> Self; // New
// Provided method
fn exhaust() -> impl Iterator<Item = Self>;
}
The Factory
is the cloneable data, so named since it is a means of constructing many Self
.
Implementors must return an iterator which produces Factory
instead of Self
.
They may then perform the final construction in from_factory()
.
Existing implementations may be migrated by adding type Factory = Self
and renaming fn exhaust()
to fn exhaust_factories()
.
However, it may be possible to simplify the iterator by moving some code into fn from_factory()
.
-
impl Exhaust for ...
core::cell::UnsafeCell
core::sync::AtomicBool
core::sync::Atomic{U,I}{8,16,32}
alloc::borrow::Cow<'_ T>
, whenT
implements onlyToOwned
rather thanClone
.std::io::BufReader
std::io::BufWriter
std::io::Chain
std::io::LineWriter
std::io::Repeat
std::io::Sink
std::io::Stderr
std::io::Stdin
std::io::Stdout
-
exhaust::Iter<T>
is a single generic iterator for allT: Exhaust
. It is now the type returned byExhaust::exhaust()
.
- The minimum supported Rust version is now 1.80.
- Breaking: The derive macro
derive(Exhaust)
now hides its generated items. They can only be accessed through the trait implementation’s associated types. - Breaking:
Exhaust::Iter
types now must implementDebug
andFusedIterator
.
<Option<T> as Exhaust>::Iter
no longer implementsDoubleEndedIterator
. This might be added back in the future.- Removed
exhaust::ExhaustArray
from the crate root. - Removed
exhaust::brute_force_search()
. - Removed the public module
exhaust::impls
. The iterators can only be accessed through the trait implementation’s associated types.
There are no changes to functionality in this release.
- Improved documentation.
- Depends on
itertools
version 0.13 instead of 0.10. - Added
rust-version
(minimum supported Rust version) information, chosen to be 1.60. exhaust::ExhaustArray
is now marked as#[deprecated]
(useexhaust::impls::ExhaustArray
instead).
impl Exhaust for ...
- Tuples of length up to 12
core::cell::Cell
core::cell::RefCell
core::cmp::Ordering
core::future::Pending
core::future::Ready
core::hash::BuildHasherDefault
core::iter::Reverse
core::marker::PhantomPinned
core::num::FpCategory
core::num::NonZero*
core::result::Result
core::task::Poll
alloc::borrow::Cow
alloc::collections::BTreeMap
alloc::collections::BTreeSet
- Note: Does not produce lexicographic ordering.
Pin<Box<T>>
std::collections::HashMap
std::collections::HashSet
std::io::Cursor
std::io::Empty
std::io::Sink
- Documentation example of a custom
impl Exhaust
.
derive(Exhaust)
generates more detailed documentation for the iterator.
- Added license texts.
- Configured GitHub Actions CI.
Initial public release.