Skip to main content

Loader

Trait Loader 

Source
pub trait Loader {
    type Component;

    // Required method
    fn load(self, ebpf: &mut Ebpf) -> Result<Self::Component, Error>;

    // Provided method
    fn configure(&self, _ebpf_loader: &mut EbpfLoader<'_>) -> Result<(), Error> { ... }
}
Expand description

This trait enforces organizational principles for configuring and loading Ebpf components. This should be implemented on configuration structs, in a builder pattern, using load(self, ebpf: &mut Ebpf) instead of the common build(self).

Required Associated Types§

Source

type Component

The component that is loaded.

Required Methods§

Source

fn load(self, ebpf: &mut Ebpf) -> Result<Self::Component, Error>

Loads the Self::Component

§Errors

Returns as Error if the Self::Component can not be loaded.

Provided Methods§

Source

fn configure(&self, _ebpf_loader: &mut EbpfLoader<'_>) -> Result<(), Error>

Optionally set map max entries or otherwise interact with the EbpfLoader.

§Errors

Returns an Error if the configuration fails.

Implementations on Foreign Types§

Source§

impl<T: Pod> Loader for (T, &str)

Source§

type Component = EbpfVar<T>

Source§

fn load(self, ebpf: &mut Ebpf) -> Result<Self::Component, Error>

Implementors§