perf_event_open/sample/auxiliary/iter/
mod.rs1use std::io::Result;
2use std::num::NonZeroUsize;
3
4mod cow;
5
6pub use cow::*;
7
8pub struct Iter<'a>(pub(super) CowIter<'a>);
10
11impl<'a> Iter<'a> {
12 pub fn next(&mut self, max_chunk_len: Option<NonZeroUsize>) -> Option<Vec<u8>> {
17 self.0.next(|cc| cc.into_owned(), max_chunk_len)
18 }
19
20 pub fn into_cow(self) -> CowIter<'a> {
22 self.0
23 }
24
25 pub fn into_async(self) -> Result<AsyncIter<'a>> {
27 Ok(AsyncIter(self.0.into_async()?))
28 }
29}
30
31pub struct AsyncIter<'a>(AsyncCowIter<'a>);
33
34impl AsyncIter<'_> {
35 pub async fn next(&mut self, max_chunk_len: Option<NonZeroUsize>) -> Option<Vec<u8>> {
40 self.0.next(|cc| cc.into_owned(), max_chunk_len).await
41 }
42}