mirror of https://github.com/aya-rs/aya
feat(aya-ebpf): introduce `array::OutOfBounds` error
Like regular arrays in Rust, arrays in eBPF are initialised upon creation. Unlike regular arrays though, the memory is simply initialised to all zeros without the user having to provide the array elements. Like regular arrays, accessing the value at a specified index will yield a reference as long as the index is within the bounds of the array. At present, the API for `Array::get` returns an `Option` where the `None` case signals the "out-of-bounds" case. Given that the user never explicitly provided any values, the `None` case may be mistaked as "the value has not been set" rather than "out of bounds". To make this more obvious, we change the API to return a new `OutOfBounds` error instead. This aligns the API with the user-space equivalent of the `Array` struct.reviewable/pr1253/r1
parent
0237e36dbe
commit
9f3a944f9b
Loading…
Reference in New Issue