perf_event_open/sample/iter/
mod.rs1use std::io::Result;
2
3use super::record::{Priv, Record};
4
5mod cow;
6
7pub use cow::*;
8
9pub struct Iter<'a>(pub(super) CowIter<'a>);
11
12impl<'a> Iter<'a> {
13 pub fn into_cow(self) -> CowIter<'a> {
15 self.0
16 }
17
18 pub fn into_async(self) -> Result<AsyncIter<'a>> {
20 Ok(AsyncIter(self.0.into_async()?))
21 }
22}
23
24impl Iterator for Iter<'_> {
25 type Item = (Priv, Record);
26
27 fn next(&mut self) -> Option<Self::Item> {
28 self.0.next(|cc, p| p.parse(cc))
29 }
30}
31
32pub struct AsyncIter<'a>(AsyncCowIter<'a>);
34
35impl AsyncIter<'_> {
36 pub async fn next(&mut self) -> Option<(Priv, Record)> {
40 self.0.next(|cc, p| p.parse(cc)).await
41 }
42}