aya: Add MapFd trait

This allows for programs to get a maps fd, like the program fd trait.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/322/head
Dave Tucker 3 years ago
parent 24597b15b7
commit e4c0cb1f5a

@ -306,6 +306,18 @@ impl Drop for Map {
}
}
/// Allows the Fd of a loaded [`Map`] to be retrieved
pub trait MapFd {
/// Returns the [`RawFd`] of the program if it has been loaded, or `None`
fn fd(&self) -> Option<RawFd>;
}
impl MapFd for Map {
fn fd(&self) -> Option<RawFd> {
self.fd
}
}
/// An iterable map
pub trait IterableMap<K: Pod, V> {
/// Get a generic map handle

Loading…
Cancel
Save