@ -5,16 +5,16 @@
//! [`Bpf::load_file`](crate::Bpf::load_file) or
//! [`Bpf::load_file`](crate::Bpf::load_file) or
//! [`Bpf::load`](crate::Bpf::load), all the maps defined in the eBPF code get
//! [`Bpf::load`](crate::Bpf::load), all the maps defined in the eBPF code get
//! initialized and can then be accessed using [`Bpf::map`](crate::Bpf::map),
//! initialized and can then be accessed using [`Bpf::map`](crate::Bpf::map),
//! [`Bpf::map_mut`](crate::Bpf::map_mut), [`Bpf::take_map`](crate::Bpf::map)
//! [`Bpf::map_mut`](crate::Bpf::map_mut), or [`Bpf::take_map`](crate::Bpf::take_map).
//! or [`Bpf::map_mut`](crate::Bpf::take_map).
//!
//!
//! # Typed maps
//! # Typed maps
//!
//!
//! The eBPF API includes many map types each supporting different operations.
//! The eBPF API includes many map types each supporting different operations.
//! [`Bpf::map`](crate::Bpf::map), [`Bpf::map_mut`](crate::Bpf::map_mut), and
//! [`Bpf::map`](crate::Bpf::map), [`Bpf::map_mut`](crate::Bpf::map_mut), and
//! [`Bpf::map_mut`](crate::Bpf::take_map) always return the
//! [`Bpf::take_map`](crate::Bpf::take_map) always return the
//! opaque [`&Map`], [`&mut Map`], and [`Map`] types respectively. Those three types can be converted to
//! opaque [`&Map`](crate::maps::Map), [`&mut Map`](crate::maps::Map), and [`Map`](crate::maps::Map)
//! *typed maps* using the [`TryFrom`](std::convert::TryFrom) or [`TryInto`](std::convert::TryInto)
//! types respectively. Those three types can be converted to *typed maps* using
//! the [`TryFrom`](std::convert::TryFrom) or [`TryInto`](std::convert::TryInto)
//! trait. For example:
//! trait. For example:
//!
//!
//! ```no_run
//! ```no_run
@ -233,7 +233,7 @@ fn maybe_warn_rlimit() {
/// eBPF map types.
/// eBPF map types.
#[ derive(Debug) ]
#[ derive(Debug) ]
pub enum Map {
pub enum Map {
/// A [ ' Array`] map
/// A [ ` Array`] map
Array ( MapData ) ,
Array ( MapData ) ,
/// A [`PerCpuArray`] map
/// A [`PerCpuArray`] map
PerCpuArray ( MapData ) ,
PerCpuArray ( MapData ) ,
@ -241,7 +241,7 @@ pub enum Map {
ProgramArray ( MapData ) ,
ProgramArray ( MapData ) ,
/// A [`HashMap`] map
/// A [`HashMap`] map
HashMap ( MapData ) ,
HashMap ( MapData ) ,
/// A [ 'PerCpuHashMap' ] map
/// A [ `PerCpuHashMap` ] map
PerCpuHashMap ( MapData ) ,
PerCpuHashMap ( MapData ) ,
/// A [`PerfEventArray`] map
/// A [`PerfEventArray`] map
PerfEventArray ( MapData ) ,
PerfEventArray ( MapData ) ,
@ -255,7 +255,7 @@ pub enum Map {
LpmTrie ( MapData ) ,
LpmTrie ( MapData ) ,
/// A [`Stack`] map
/// A [`Stack`] map
Stack ( MapData ) ,
Stack ( MapData ) ,
/// A [`StackTrace `] map
/// A [`StackTrace Map `] map
StackTraceMap ( MapData ) ,
StackTraceMap ( MapData ) ,
/// A [`Queue`] map
/// A [`Queue`] map
Queue ( MapData ) ,
Queue ( MapData ) ,
@ -556,7 +556,7 @@ impl MapData {
/// Loads a map from a [`RawFd`].
/// Loads a map from a [`RawFd`].
///
///
/// If loading from a BPF Filesystem (bpffs) you should use [`Map::from_pin`] .
/// If loading from a BPF Filesystem (bpffs) you should use [`Map::from_pin`] (crate::maps::MapData::from_pin) .
/// This API is intended for cases where you have received a valid BPF FD from some other means.
/// This API is intended for cases where you have received a valid BPF FD from some other means.
/// For example, you received an FD over Unix Domain Socket.
/// For example, you received an FD over Unix Domain Socket.
pub fn from_fd ( fd : RawFd ) -> Result < MapData , MapError > {
pub fn from_fd ( fd : RawFd ) -> Result < MapData , MapError > {