Expand description
Idomatic Rust bindings for eBPF programs, probes, and maps. Want write in-line eBPF without relying on external dependencies, like shelling out to bcc/llvm? Check out this crate’s sister crates:
§Usage
use bpf_api::collections::Array;
const ARRAY_SIZE: u32 = 10;
let array = Array::<u32>::with_capacity(ARRAY_SIZE).unwrap();
for i in 0..ARRAY_SIZE {
let val = i + 100;
assert!(matches!(array.get(i), Ok(0)));
assert!(array.set(i, val).is_ok());
match array.get(i) {
Ok(v) => assert_eq!(v, val),
Err(e) => panic!("array.get() failed: {}", e),
}
}