0.5.0
[0.5.0] - 2026-02-10
New
-
New infrastructure to check covariance of lends. Every implementation must
use either the (safe)check_covariance!/check_covariance_fallible!macros
(for sources) to check covariance of the lend lifetime, or the (unsafe)
unsafe_assume_covariance!/unsafe_assume_covariance_fallible!macros when
assuming covariance of underlying lends (without any check). Methods that used
to takefor<'all> Lending<'all>now takeCovariantLending, which depends
onfor<'all> Lending<'all, L>but forces a covariance check. -
Covariance checks have also been embedded in the
covar!,covar_mut!and
covar_oncemacros (formerlyhrc...), which are now required to pass a
closure, as closures are passed through theCovarwrapper, which forces
a covariance check. This unfortunately includes closures without lifetimes. -
Added missing
FromFallibleLender/ExtendFallibleLendertraits. -
The
Convertadapter is now accessible through theLender::convertmethod.
Improved
-
windows_mutis now double-ended. -
Fallible lenders have now feature parity with normal lenders. In particular,
FallibleLenderhas nowchunkandrpositionmethods. -
Thanks to
AliasableBoxandMaybeDanglingwe now pass miri. -
FallibleLender::advance_by/FallibleLender::advance_back_byhave now a
signature aligned withLender::advance_by/Lender::advance_back_by. -
Completed implementation of standard traits (
Debug,Clone,Default, etc.)
where possible.
Changed
-
Macros
hrc,hrc_mutandhrc_oncehave been renamed tocovar,covar_mut
andcovar_once, respectively. -
Windows and array windows must have a non-zero length, as in
Iterator,
and they implementFusedLenderandExactSizeLender. -
The return type of
Peekable::peekis nowOption<&'_ Lend<'_, L>>, which
fixes a problem of data escape. Analogously forFalliblePeekable::peek. -
The
lend!macro now covers just a set of fixed covariant types. If you need
to use more complex types, you can use thecovariant_lend!macro, which
however requires that you define a type name (with an optional
visibility specifier), as it cannot be inlined. The same applies to
fallible_lend!andcovariant_fallible_lend!. -
Coherent use of
must_useattribute. -
Fallible sources and adapters are now uniformly in separate modules with the
same name of the standard ones and are renamed inmod.rs. -
Fallible
once,repeat, etc. now follow thefallible_iteratordesign,
with specific methods likeonce_err,repeat_err, etc. to generate
errors. -
FallibleFusedLenderguaranteesOk(None)to repeat, but does not
have anymore a guarantee of behavior after an error (like it
happens withfallible_iterator). -
min/maxnow requireOrd, like the standardIteratormethods. -
IntoFalliblenow usesInfallibleas fixed error type, like
fallible_iterator.
Fixed
-
Several possible UBs are no longer possible thanks to the new covariance
checking infrastructure. -
PeekableandFalliblePeekableare now deallocating their fields
in the correct order. -
All implementations propagate correctly fused, double-ended and exact-size
traits. -
max/max_byreturn the last instance in case of ties, as inIterator
(previously they returned the first instance). -
All repeat method return
(usize::MAX, None)onsize_hint, as inIterator,
if they return a value, or(0, Some(0))if they return an error. -
The order of parameters (lend/error) in a few methods was inconsistent.
-
Removed
Cloneimplementation that could lead to UB fromPeekableand
FlattenCompat.