Adaptor declaration
As you saw with cargo-prosa, available adaptor can be listed using cargo prosa list
.
This allows you to easily add your adaptor to the ProSA.toml configuration file.
To build this list, cargo-prosa leverages cargo metadata. Thanks to this, it can retrieve metadata from your dependencies and show the list of adaptors you have defined.
To declare your own adaptor, add the following metadata to your Cargo.toml:
[package.metadata.prosa.<processor_name>]
adaptor = ["<your crate name>::<path to your adaptor>"]
An adaptor is always related to a processor. That's why you need to declare your adaptor under the relevant processor name.
The adaptor
field is a list. So you can declare as many adaptors as you want. In most cases, there are multiple adaptors per processor.
For an example, see the ProSA Cargo.toml.
You can also include your processor declaration in this metadata block if you declare your adaptor in the same crate as your processor.
This declaration step is very important because it simplifies the build process with cargo-prosa.