mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-28 04:46:12 +00:00
Add Handles::first
This commit is contained in:
parent
8f40971d94
commit
1f776e7ff9
@ -80,6 +80,17 @@ impl<T> Handles<T> {
|
||||
item
|
||||
}
|
||||
|
||||
/// Return the first item
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics, if there are no items.
|
||||
pub fn first(&self) -> &Handle<T> {
|
||||
self.inner
|
||||
.first()
|
||||
.expect("Requested first item, but no items available")
|
||||
}
|
||||
|
||||
/// Return the n-th item
|
||||
pub fn nth(&self, index: usize) -> Option<&Handle<T>> {
|
||||
self.inner.get(index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user