Attribute Macro junobuild_macros::assert_delete_asset
source · #[assert_delete_asset]
Expand description
The assert_delete_asset
function is a procedural macro attribute for asserting conditions before deleting an asset.
It enables you to define custom validation logic to be executed prior to an asset being deleted.
Example:
#[assert_delete_asset]
fn assert_delete_asset(context: AssertDeleteAssetContext) -> Result<(), String> {
// Your assertion logic here
}
When no attributes are provided, the assertion logic is applied to any asset deletion within any collection. You can scope the assertion to a particular list of collections.
Example:
#[assert_delete_asset(collections = ["assets"])]
fn juno_assert_delete_asset(context: AssertDeleteAssetContext) -> Result<(), String> {
// Your assertion logic here, specific to the "assets" collection
}
The attributes accept a list of comma-separated collections. If the attribute array is left empty, the assertion will always be evaluated.