Selaa lähdekoodia

aya: tweak PerfEventArray docs

Alessandro Decina 3 vuotta sitten
vanhempi
commit
6ecf7dabf3
2 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 3 3
      aya/src/maps/hash_map/hash_map.rs
  2. 1 1
      aya/src/maps/perf/perf_event_array.rs

+ 3 - 3
aya/src/maps/hash_map/hash_map.rs

@@ -22,10 +22,10 @@ use crate::{
 /// use aya::maps::HashMap;
 /// use std::convert::TryFrom;
 ///
-/// const CONFIG_KEY_NUM_RETRIES: u8 = 1;
+/// let mut redirect_ports = HashMap::try_from(bpf.map_mut("REDIRECT_PORTS")?)?;
 ///
-/// let mut hm = HashMap::try_from(bpf.map_mut("CONFIG")?)?;
-/// hm.insert(CONFIG_KEY_NUM_RETRIES, 3, 0 /* flags */);
+/// redirect_ports.insert(80, 8080, 0 /* flags */);
+/// redirect_ports.insert(443, 8443, 0 /* flags */);
 /// # Ok::<(), aya::BpfError>(())
 /// ```
 #[doc(alias = "BPF_MAP_TYPE_HASH")]

+ 1 - 1
aya/src/maps/perf/perf_event_array.rs

@@ -137,7 +137,7 @@ impl<T: DerefMut<Target = Map>> AsRawFd for PerfEventArrayBuffer<T> {
 ///
 /// # Polling and avoiding lost events
 ///
-/// In the example above the implementation of `poll_buffers` and `poll.poll_readable()` is not
+/// In the example above the implementation of `poll_buffers()` and `poll.poll_readable()` is not
 /// given. [`PerfEventArrayBuffer`] implements the [`AsRawFd`] trait, so you can implement polling
 /// using any crate that can poll file descriptors, like [epoll], [mio] etc.  
 ///