diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index ea407f4e..aee4be4e 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -183,6 +183,17 @@ impl Bpf { .transpose() } + pub fn maps<'a>(&'a self) -> impl Iterator)> + 'a { + let ret = self.maps.iter().map(|(name, lock)| { + ( + name.as_str(), + lock.try_read() + .map_err(|_| MapError::BorrowError { name: name.clone() }), + ) + }); + ret + } + pub fn program<'a, 'slf: 'a, T: TryFrom<&'a Program>>( &'slf self, name: &str,