Merge pull request #121 from eero-thia/thia/programs_mut

aya: programs_mut iterator to complement programs.
pull/115/head
Alessandro Decina 3 years ago committed by GitHub
commit 2955ca1d1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -521,7 +521,7 @@ impl Bpf {
///
/// # Examples
/// ```no_run
/// # let mut bpf = aya::Bpf::load(&[])?;
/// # let bpf = aya::Bpf::load(&[])?;
/// for program in bpf.programs() {
/// println!(
/// "found program `{}` of type `{:?}`",
@ -534,6 +534,22 @@ impl Bpf {
pub fn programs(&self) -> impl Iterator<Item = &Program> {
self.programs.values()
}
/// An iterator mutably referencing all of the programs.
///
/// # Examples
/// ```no_run
/// # use std::path::Path;
/// # let mut bpf = aya::Bpf::load(&[])?;
/// # let pin_path = Path::new("/tmp/pin_path");
/// for program in bpf.programs_mut() {
/// program.pin(pin_path)?;
/// }
/// # Ok::<(), aya::BpfError>(())
/// ```
pub fn programs_mut(&mut self) -> impl Iterator<Item = &mut Program> {
self.programs.values_mut()
}
}
/// The error type returned by [`Bpf::load_file`] and [`Bpf::load`].

Loading…
Cancel
Save