Skip to main content

agave_xdp_ebpf/
lib.rs

1#![cfg_attr(
2    not(feature = "agave-unstable-api"),
3    deprecated(
4        since = "3.1.0",
5        note = "This crate has been marked for formal inclusion in the Agave Unstable API. From \
6                v4.0.0 onward, the `agave-unstable-api` crate feature must be specified to \
7                acknowledge use of an interface that may break without warning."
8    )
9)]
10// Activate some of the Rust 2024 lints to make the future migration easier.
11#![warn(if_let_rescope)]
12#![warn(keyword_idents_2024)]
13#![warn(missing_unsafe_on_extern)]
14#![warn(rust_2024_guarded_string_incompatible_syntax)]
15#![warn(rust_2024_incompatible_pat)]
16#![warn(tail_expr_drop_order)]
17#![warn(unsafe_attr_outside_unsafe)]
18#![warn(unsafe_op_in_unsafe_fn)]
19#![no_std]
20
21#[repr(C, align(4))]
22pub struct Aligned<Bytes: ?Sized>(Bytes);
23
24impl<Bytes: ?Sized> core::ops::Deref for Aligned<Bytes> {
25    type Target = Bytes;
26    fn deref(&self) -> &Self::Target {
27        &self.0
28    }
29}
30
31#[cfg(all(target_os = "linux", not(target_arch = "bpf")))]
32#[unsafe(no_mangle)]
33pub static AGAVE_XDP_EBPF_PROGRAM: &Aligned<[u8]> = &Aligned(*include_bytes!(concat!(
34    env!("CARGO_MANIFEST_DIR"),
35    "/agave-xdp-prog"
36)));