Expand description
Derives for LibAFL
§LibAFL_derive: Derive Macros for LibAFL
The libafl_derive crate offers derive macros, such as #[derive(SerdeAny)].
§Available Derive Macros
§#[derive(SerdeAny)]
This macro implements the SerdeAny trait for a type. This is necessary to store the type in a SerdeAnyMap, a key component for type-safe storage of different data types in LibAFL.
Usage:
use libafl_derive::SerdeAny;
use serde::{Serialize, Deserialize};
#[derive(SerdeAny, Serialize, Deserialize)]
struct MyStruct {
// ...
}§#[derive(Display)]
This macro implements the core::fmt::Display trait for a struct. It generates a Display implementation that concatenates the string representations of all fields, separated by spaces.
Special Handling:
Option<T>: If the value isSome(inner), the inner value is displayed. If it isNone, nothing is displayed.Vec<T>: The elements of the vector are displayed, each separated by a space.
Example:
use libafl_derive::Display;
use std::fmt::Display;
#[derive(Display)]
struct MyStruct {
foo: String,
bar: Option<u32>,
baz: Vec<i32>,
}
let instance = MyStruct {
foo: "hello".to_string(),
bar: Some(42),
baz: vec![1, 2, 3],
};
// The following will print: " hello 42 1 2 3"
println!("{}", instance);§The LibAFL Project
The LibAFL project is part of AFLplusplus and maintained by
- Andrea Fioraldi andrea@aflplus.plus
- Dominik Maier dominik@aflplus.plus
- s1341 github@shmarya.net
- Dongjia Zhang toka@aflplus.plus
- Addison Crump me@addisoncrump.info
§Contributing
For bugs, feel free to open issues or contact us directly. Thank you for your support. <3
Even though we will gladly assist you in finishing up your PR, try to
- keep all the crates compiling with stable rust (hide the eventual non-stable code under
cfgs.) - run
cargo nightly fmton your code before pushing - check the output of
cargo clippy --allor./clippy.sh - run
cargo build --no-default-featuresto check forno_stdcompatibility (and possibly add#[cfg(feature = "std")]) to hide parts of your code.
Some parts in this list may sound hard, but don’t be afraid to open a PR if you cannot fix them by yourself. We will gladly assist.
§License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies under more restrictive licenses, such as GPL or AGPL, can be enabled using the respective feature in each crate when it is present, such as the 'agpl' feature of the libafl crate.