Module subtr_actor::ndarray
source · Macros
- This macro creates a global
FeatureAdderstruct and implements the necessary traits to add the calculated features to the data matrix. The macro exports a struct with the same name as passed in the parameter. The number of column names and the length of the feature array returned by$prop_getterare checked at compile time to ensure they match, in line with theLengthCheckedFeatureAddertrait. The output struct also provides an implementation of theFeatureAddertrait via theimpl_feature_adder!macro, allowing it to be used in contexts where aFeatureAdderobject is required. - This macro creates a player feature adder struct and implements the necessary traits to add the calculated player-specific features to the data matrix. The macro exports a struct with the same name as passed in the parameter. The number of column names and the length of the feature array returned by
$prop_getterare checked at compile time to ensure they match, in line with theLengthCheckedPlayerFeatureAddertrait. The output struct also provides an implementation of thePlayerFeatureAddertrait via theimpl_player_feature_adder!macro, allowing it to be used in contexts where aPlayerFeatureAdderobject is required. - A macro that tries to convert each provided item into a type. If any of the conversions fail, it short-circuits and returns the error.
- A convenience macro that uses the
convert_allmacro with theconvert_float_conversion_errorfunction for error handling. - This macro is used to implement necessary traits for an existing struct to add the calculated features to the data matrix. This macro is particularly useful when the feature adder needs to be instantiated with specific parameters. The number of column names and the length of the feature array returned by
$prop_getterare checked at compile time to ensure they match. - A macro to provide an automatic implementation of the
FeatureAddertrait for types that implementLengthCheckedFeatureAdder. This allows you to take advantage of the compile-time guarantees provided byLengthCheckedFeatureAdder, while still being able to use your type in contexts that require aFeatureAdderobject. This macro is used to bridge the gap between the two traits, as Rust’s type system does not currently provide a way to prove to the compiler that there will always be exactly one implementation ofLengthCheckedFeatureAdderfor each type. - A macro to provide an automatic implementation of the
PlayerFeatureAddertrait for types that implementLengthCheckedPlayerFeatureAdder. This allows you to take advantage of the compile-time guarantees provided byLengthCheckedPlayerFeatureAdder, while still being able to use your type in contexts that require aPlayerFeatureAdderobject. This macro is used to bridge the gap between the two traits, as Rust’s type system does not currently provide a way to prove to the compiler that there will always be exactly one implementation ofLengthCheckedPlayerFeatureAdderfor each type. - This macro is used to implement necessary traits for an existing struct to add the calculated player-specific features to the data matrix. This macro is particularly useful when the feature adder needs to be instantiated with specific parameters. The number of column names and the length of the feature array returned by
$prop_getterare checked at compile time to ensure they match.
Structs
NDArrayCollectoris aCollectorwhich transforms frame-based replay data into a 2-dimensional array of typendarray::Array2, where each element is of a specified floating point type.- Represents the column headers in the collected data of an
NDArrayCollector. - A struct that contains both the metadata of a replay and the associated column headers.
Statics
Traits
- This trait acts as an abstraction over a feature adder, and is primarily used to allow for heterogeneous collections of feature adders in the
NDArrayCollector. While it provides methods for adding features and retrieving column headers, it is generally recommended to implement theLengthCheckedFeatureAddertrait instead, which provides compile-time guarantees about the number of features returned. - This trait is stricter version of the
FeatureAddertrait, enforcing at compile time that the number of features added is equal to the number of column headers provided. Implementations of this trait can be automatically adapted to theFeatureAddertrait using theimpl_feature_adder!macro. - This trait is a more strict version of the
PlayerFeatureAddertrait, enforcing at compile time that the number of player-specific features added is equal to the number of column headers provided. Implementations of this trait can be automatically adapted to thePlayerFeatureAddertrait using theimpl_player_feature_adder!macro. - This trait acts as an abstraction over a player-specific feature adder, and is primarily used to allow for heterogeneous collections of player feature adders in the
NDArrayCollector. While it provides methods for adding player-specific features and retrieving column headers, it is generally recommended to implement theLengthCheckedPlayerFeatureAddertrait instead, which provides compile-time guarantees about the number of features returned.
Functions
- Extracts the location, rotation, linear velocity and angular velocity from a
boxcars::RigidBodyand converts them to a type implementingTryFrom<f32>. - Extracts the location and rotation from a
boxcars::RigidBodyand converts them to a type implementingTryFrom<f32>.