Skip to content

Commit 6986317

Browse files
Add iter() to owned slice (#1620)
1 parent 47cd4df commit 6986317

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

libafl_bolts/src/ownedref.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ impl<'a, T> OwnedSlice<'a, T> {
286286
}
287287
}
288288
}
289+
290+
/// Returns an iterator over the slice.
291+
pub fn iter(&self) -> Iter<'_, T> {
292+
<&Self as IntoIterator>::into_iter(self)
293+
}
289294
}
290295

291296
impl<'a, 'it, T> IntoIterator for &'it OwnedSlice<'a, T> {
@@ -509,6 +514,16 @@ impl<'a, T: 'a + Sized> OwnedMutSlice<'a, T> {
509514
}
510515
}
511516
}
517+
518+
/// Returns an iterator over the slice.
519+
pub fn iter(&self) -> Iter<'_, T> {
520+
<&Self as IntoIterator>::into_iter(self)
521+
}
522+
523+
/// Returns a mutable iterator over the slice.
524+
pub fn iter_mut(&mut self) -> IterMut<'_, T> {
525+
<&mut Self as IntoIterator>::into_iter(self)
526+
}
512527
}
513528

514529
impl<'a, T: Sized> AsSlice for OwnedMutSlice<'a, T> {

0 commit comments

Comments
 (0)