Added `completed_{ref,mut}()` methods as pancking complements for `try_completed_{ref,mut}()`.

Fortune for parapop's current commit: Curse − 凶
master
Avril 3 years ago
parent fa6eb5810d
commit 02821a2aa9
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -407,6 +407,26 @@ impl<'a, T> Populator<'a, T>
None
}
}
/// Returns a slice of all the elements
///
/// # Panics
/// If the collection was not full.
#[inline]
pub fn completed_ref(&self) -> &[T]
{
self.try_completed_ref().expect("Collection was not fully populated")
}
/// Returns a mutable slice of all the elements
///
/// # Panics
/// If the collection was not full.
#[inline]
pub fn completed_mut(&mut self) -> &[T]
{
self.try_completed_mut().expect("Collection was not fully populated")
}
/// If all values are populated, returns a mutable slice of all the elements.
///

Loading…
Cancel
Save