pub fn contains_policy_id(
asset_list: &Option<Vec<Asset>>,
target_policy_id: &str,
) -> bool
Expand description
Checks if a target policy ID exists in the asset list.
This function checks whether a specified target_policy_id
exists
within the provided asset_list
. If the asset_list
is None
, the function
returns false
.
§Arguments
asset_list
- An optional reference to a vector ofAsset
items.target_policy_id
- A string slice representing the policy ID to search for.
§Returns
true
- If the target policy ID exists in the asset list.false
- If the target policy ID does not exist or the asset list isNone
.
§Behavior
- Safely handles
None
values forasset_list
usingmap_or
. - Uses
iter().any()
to efficiently search for a matching policy ID.