junobuild_satellite

Function count_collection_assets_store

Source
pub fn count_collection_assets_store(
    collection: &CollectionKey,
) -> Result<usize, String>
Expand description

Count the number of assets in a collection’s store.

This function retrieves the state rule for the specified collection and counts the assets based on the memory type (Heap or Stable). It returns the count as a Result<usize, String> on success, or an error message as Err(String) if an issue occurs during counting.

§Parameters

  • collection: A reference to the CollectionKey representing the collection to count assets in.

§Returns

  • Ok(usize): The count of assets in the collection.
  • Err(String): An error message if counting fails.

This function provides a convenient way to determine the number of assets in a Juno collection’s store.