More docs

pull/1/head
Alessandro Decina 3 years ago
parent ad58e171ff
commit 293e66af65

@ -297,7 +297,7 @@ impl Bpf {
///
/// Returns [`ProgramError::NotFound`] if the program does not exist.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
@ -322,7 +322,7 @@ impl Bpf {
///
/// Returns [`ProgramError::NotFound`] if the program does not exist.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let mut bpf = aya::Bpf::load(&[], None)?;

@ -17,7 +17,7 @@ use crate::{
/// The size of the array is defined on the eBPF side using the `bpf_map_def::max_entries` field.
/// All the entries are zero-initialized when the map is created.
///
/// # Example
/// # Examples
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
/// use aya::maps::Array;

@ -17,7 +17,7 @@ use crate::{
/// The size of the array is defined on the eBPF side using the `bpf_map_def::max_entries` field.
/// All the entries are zero-initialized when the map is created.
///
/// # Example
/// # Examples
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]
/// # enum Error {

@ -20,7 +20,7 @@ use crate::{
/// prog_array, index)`. You can use [`ProgramArray`] to configure which
/// programs correspond to which jump indexes.
///
/// # Example
/// # Examples
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
/// use aya::maps::ProgramArray;

@ -13,7 +13,7 @@ use crate::{
/// A hash map that can be shared between eBPF programs and user space.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;

@ -20,7 +20,7 @@ use crate::{
/// This type can be used with eBPF maps of type `BPF_MAP_TYPE_PERCPU_HASH` and
/// `BPF_MAP_TYPE_LRU_PERCPU_HASH`.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
@ -97,7 +97,7 @@ impl<T: Deref<Target = Map>, K: Pod, V: Pod> PerCpuHashMap<T, K, V> {
impl<T: DerefMut<Target = Map>, K: Pod, V: Pod> PerCpuHashMap<T, K, V> {
/// Inserts a slice of values - one for each CPU - for the given key.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -321,7 +321,7 @@ impl PerCpuKernelMem {
///
/// Used by maps that implement per-CPU storage like [`PerCpuHashMap`].
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -26,7 +26,7 @@ use crate::maps::{
/// * call [`AsyncPerfEventArray::open`]
/// * call [`AsyncPerfEventArrayBuffer::read_events`] to read the events
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -76,7 +76,7 @@ impl<T: DerefMut<Target = Map>> AsRawFd for PerfEventArrayBuffer<T> {
/// inserted in the buffer
/// * call [`PerfEventArrayBuffer::read_events`] to read the events
///
/// # Example
/// # Examples
///
/// A common way to use a perf array is to have one perf buffer for each
/// available CPU:

@ -80,7 +80,7 @@ impl<T: Deref<Target = Map> + DerefMut<Target = Map>, V: Pod> Queue<T, V> {
///
/// [`MapError::SyscallError`] if `bpf_map_update_elem` fails.
///
/// # Example
/// # Examples
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
/// use aya::maps::Queue;

@ -23,10 +23,10 @@ use crate::{
/// A `SockHash` can also be used to redirect packets to sockets contained by the
/// map using `bpf_redirect_map()`, `bpf_sk_redirect_hash()` etc.
///
/// # Example
/// # Examples
///
/// ```no_run
/// ##[derive(Debug, thiserror::Error)]
/// # #[derive(Debug, thiserror::Error)]
/// # enum Error {
/// # #[error(transparent)]
/// # IO(#[from] std::io::Error),

@ -22,7 +22,7 @@ use crate::{
/// A `SockMap` can also be used to redirect packets to sockets contained by the
/// map using `bpf_redirect_map()`, `bpf_sk_redirect_map()` etc.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let mut bpf = aya::Bpf::load(&[], None)?;

@ -15,7 +15,7 @@ use crate::{
/// A LIFO stack.
///
/// # Example
/// # Examples
/// ```no_run
/// # let bpf = aya::Bpf::load(&[], None)?;
/// use aya::maps::Stack;

@ -18,7 +18,7 @@ use crate::{
/// `stack_id = bpf_get_stackid(ctx, map, flags)` from eBPF, and then you can retrieve the traces
/// from their stack ids.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -70,7 +70,7 @@ pub enum BtfError {
MaximumTypeDepthReached { type_id: u32 },
}
/// Bpf Type Format (BTF) metadata.
/// Bpf Type Format metadata.
///
/// BTF is a kind of debug metadata that allows eBPF programs compiled against one kernel version
/// to be loaded into different kernel versions.

@ -19,7 +19,7 @@ use super::FdLink;
///
/// [cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -20,7 +20,7 @@ use crate::{
/// - `kprobe`: get attached to the *start* of the target functions
/// - `kretprobe`: get attached to the *return address* of the target functions
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;

@ -11,10 +11,10 @@ use crate::{
/// filter and redirect messages sent on sockets. See also [`SockMap`] and
/// [`SockHash`].
///
/// # Example
/// # Examples
///
/// ```no_run
/// ##[derive(Debug, thiserror::Error)]
/// # #[derive(Debug, thiserror::Error)]
/// # enum Error {
/// # #[error(transparent)]
/// # IO(#[from] std::io::Error),

@ -21,7 +21,7 @@ pub enum SkSkbKind {
/// inspect, redirect or filter incoming packet. See also [`SockMap`] and
/// [`SockHash`].
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let mut bpf = aya::Bpf::load(&[], None)?;

@ -12,7 +12,7 @@ use crate::{
/// parameters, watch connection state changes and more. They are attached to
/// cgroups.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # #[derive(thiserror::Error, Debug)]

@ -27,10 +27,10 @@ pub enum SocketFilterError {
/// and filter incoming packets.
///
///
/// # Example
/// # Examples
///
/// ```no_run
/// ##[derive(Debug, thiserror::Error)]
/// # #[derive(Debug, thiserror::Error)]
/// # enum Error {
/// # #[error(transparent)]
/// # IO(#[from] std::io::Error),

@ -30,10 +30,10 @@ pub enum TcAttachType {
/// linux network traffic control system. See
/// [https://man7.org/linux/man-pages/man8/tc-bpf.8.html](https://man7.org/linux/man-pages/man8/tc-bpf.8.html).
///
/// # Example
/// # Examples
///
/// ```no_run
/// ##[derive(Debug, thiserror::Error)]
/// # #[derive(Debug, thiserror::Error)]
/// # enum Error {
/// # #[error(transparent)]
/// # IO(#[from] std::io::Error),

@ -22,10 +22,10 @@ pub enum TracePointError {
/// be attached to. See `/sys/kernel/debug/tracing/events` for a list of which
/// events can be traced.
///
/// # Example
/// # Examples
///
/// ```no_run
/// ##[derive(Debug, thiserror::Error)]
/// # #[derive(Debug, thiserror::Error)]
/// # enum Error {
/// # #[error(transparent)]
/// # IO(#[from] std::io::Error),

@ -46,7 +46,7 @@ bitflags! {
/// underlying network driver, XDP programs can execute directly on network cards, greatly
/// reducing CPU load.
///
/// # Example
/// # Examples
///
/// ```no_run
/// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;

Loading…
Cancel
Save