Tuple_List_Ex: Added functionality for tuple_lists
This crate adds handy features to the Haskel-like tuple_list crate.
It's part of the LibAFL project.
Usage
This crate provides a variety of traits that extend the functionality of tuple_list. Here are a few examples:
MatchFirstType
Get the first element of a specific type from a tuple list.
use tuple_list;
use MatchFirstType;
// Create a tuple list
let tuple = tuple_list!;
// Get the first element of a specific type
let first_i32: = tuple.match_first_type;
assert_eq!;
let first_f64: = tuple.match_first_type;
assert_eq!;
Prepend, Append, and Merge
Modify tuple lists by adding elements or merging them.
use tuple_list;
use ;
let tuple = tuple_list!;
// Prepend an element
let prepended = tuple.prepend;
assert_eq!;
// Append an element
let appended = prepended.append;
assert_eq!;
// Merge two tuple lists
let other_tuple = tuple_list!;
let merged = prepended.merge;
assert_eq!;
NamedTuple and MatchName
Access elements by name for tuples containing Named elements.
#
#
Features
This crate has the following features:
std: (Default) Enables features that require the standard library.alloc: (Default) Enables features that require allocation, likeIntoVecandNamedTuple.serde: Enablesserdesupport forHandle.
Provided Traits and Functionality
Here is a list of the traits and functionality provided by this crate:
SplitBorrow: Borrows each member of the tuple, returning a new tuple of references.IntoVec: Converts a tuple list into aVec.HasConstLen: Provides the length of the tuple list as a constusize.MatchFirstType: Gets the first element of a specific type.ExtractFirstRefTypeandExtractFirstRefMutType: Takes the first element of a given type.SplitBorrowExtractFirstType: A combination ofSplitBorrowandExtractFirstRefType.MatchType: Applies a function to all elements of a specific type.NamedTuple: For tuples where each element has a name.MatchName: Finds an element by its name.Handled,Handle,MatchNameRef: A system for referencing tuple elements by a handle (name + type).GetAll: Retrieves multiple elements from a tuple list using a list of handles.RefIndexable: Allows indexing a tuple list with[]using handles.Prepend: Adds an element to the beginning of a tuple list.Append: Adds an element to the end of a tuple list.Merge: Merges two tuple lists.Map,MappingFunctor: Maps each element of a tuple list to a new type.- Macros:
tuple_for_each!: Iterates over a tuple.tuple_for_each_mut!: Iterates over a tuple with mutable access.map_tuple_list_type!: Gets the resulting type of a map operation.merge_tuple_list_type!: Gets the resulting type of a merge operation.
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.