pub trait ProgramArgument: Into<BpfValue> {
// Required method
fn get_type() -> &'static Type;
// Provided methods
fn get_value_type(&self) -> Type { ... }
fn field_mappings() -> &'static [FieldMapping] { ... }
fn struct_mapping() -> Option<StructMapping> { ... }
}Expand description
Trait that should be implemented for arguments passed to eBPF programs.
Required Methods§
Provided Methods§
Sourcefn get_value_type(&self) -> Type
fn get_value_type(&self) -> Type
Returns eBPF type for a specific value of Self. For most types this is the
same type that’s returned by get_type(), but that’s not always the case.
In particular for scalar values this will return Type::ScalarValue with
the actual value of the scalar and with unknown_mask = 0.
Sourcefn field_mappings() -> &'static [FieldMapping]
fn field_mappings() -> &'static [FieldMapping]
Returns the list of field mappings that should be applied with this argument.
If not empty then get_type() must be a PtrToStruct.
Sourcefn struct_mapping() -> Option<StructMapping>
fn struct_mapping() -> Option<StructMapping>
Returns the StructMapping that should be applied with this argument. Implementations
should override field_mappings() and keep default implementation of struct_mapping().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.