From 515f7f87ceb4615a2d90a238a82597d6b2d52d02 Mon Sep 17 00:00:00 2001 From: Sean Olson Date: Tue, 29 Oct 2024 15:03:05 -0700 Subject: [PATCH] Demonstrate `OrSaturated` in the vacancy and saturation section. --- src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1932aba..d701e19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -177,12 +177,14 @@ //! use mitsein::iter1; //! use mitsein::prelude::*; //! -//! // `saturate` returns an output and remainder: the output is an `ArrayVec1` here. -//! let xs: ArrayVec1<_, 4> = iter1::repeat(0i64).saturate().output(); +//! // `saturate` returns an output and remainder: here, the output is an `ArrayVec1`. +//! let mut xs: ArrayVec1<_, 4> = iter1::repeat(0i64).saturate().output(); +//! assert_eq!(xs.push_or_get_last(42), Err((42, &0))); //! //! let mut ys = Vec1::from_one_with_capacity(0i64, 4); //! let vacancy = ys.vacancy(); //! ys.saturate(iter1::repeat(1i64)); +//! assert_eq!(ys.insert_or_get(1, 88), Err((88, &1))); //! //! assert_eq!(xs.as_slice(), &[0, 0, 0, 0]); //! assert_eq!(ys.as_slice(), &[0, 1, 1, 1]); @@ -190,7 +192,8 @@ //! assert_eq!(vacancy, 3); #![doc = "```"] //! -//! See the [`Vacancy`] trait and the [`ExtendUntil`] and [`FromIteratorUntil`] traits. +//! See the [`Vacancy`] and [`OrSaturated`] traits and also the [`ExtendUntil`] and +//! [`FromIteratorUntil`] traits. //! //! # Integrations and Cargo Features //!