Repository: paritytech/substrate
File: frame/support/src/traits/tokens/nonfungibles_v2.rs (Rust)

Code before:
	/// The iterator type for [`Self::items`].
	type ItemsIterator: Iterator<Item = Self::ItemId>;
	/// The iterator type for [`Self::owned`].
	type OwnedIterator: Iterator<Item = (Self::CollectionId, Self::ItemId)>;
	/// The iterator type for [`Self::owned_in_collection`].
	type OwnedInCollectionIterator: Iterator<Item = Self::ItemId>;

	/// Returns an iterator of the collections in existence.
	fn collections() -> Self::CollectionsIterator;

	/// Returns an iterator of the items of a `collection` in existence.
	fn items(collection: &Self::CollectionId) -> Self::ItemsIterator;

	/// Returns an iterator of the items of all collections owned by `who`.
	fn owned(who: &AccountId) -> Self::OwnedIterator;

	/// Returns an iterator of the items of `collection` owned by `who`.
	fn owned_in_collection(
		collection: &Self::CollectionId,
		who: &AccountId,
	) -> Self::OwnedInCollectionIterator;
}

/// Trait for providing an interface to read-only the role of NFT-like.
pub trait InspectRole<AccountId>: Inspect<AccountId> {
	// Return `true` if collection issuer.
	fn is_issuer(collection: &Self::CollectionId, who: &AccountId) -> bool;
	// Return `true` if collection admin.
	fn is_admin(collection: &Self::CollectionId, who: &AccountId) -> bool;
	// Return `true` if collection freezer.
	fn is_freezer(collection: &Self::CollectionId, who: &AccountId) -> bool;
}

/// Trait for providing the ability to create collections of nonfungible items.
pub trait Create<AccountId, CollectionConfig>: Inspect<AccountId> {
	/// Create a `collection` of nonfungible items to be owned by `who` and managed by `admin`.
	fn create_collection(
		who: &AccountId,
		admin: &AccountId,
		config: &CollectionConfig,
	) -> Result<Self::CollectionId, DispatchError>;
}

/// Trait for providing the ability to destroy collections of nonfungible items.
pub trait Destroy<AccountId>: Inspect<AccountId> {
	/// The witness data needed to destroy an item.
	type DestroyWitness: Parameter;

	/// Provide the appropriate witness data needed to destroy an item.
	fn get_destroy_witness(collection: &Self::CollectionId) -> Option<Self::DestroyWitness>;


Review comment (suggestion):
1) pls use `///` instead of `//` here and below
2) I would copy the description from the above ("Returns `true` if `who` is the issuer of the `collection`.")

Code after:
	/// The iterator type for [`Self::items`].
	type ItemsIterator: Iterator<Item = Self::ItemId>;
	/// The iterator type for [`Self::owned`].
	type OwnedIterator: Iterator<Item = (Self::CollectionId, Self::ItemId)>;
	/// The iterator type for [`Self::owned_in_collection`].
	type OwnedInCollectionIterator: Iterator<Item = Self::ItemId>;

	/// Returns an iterator of the collections in existence.
	fn collections() -> Self::CollectionsIterator;

	/// Returns an iterator of the items of a `collection` in existence.
	fn items(collection: &Self::CollectionId) -> Self::ItemsIterator;

	/// Returns an iterator of the items of all collections owned by `who`.
	fn owned(who: &AccountId) -> Self::OwnedIterator;

	/// Returns an iterator of the items of `collection` owned by `who`.
	fn owned_in_collection(
		collection: &Self::CollectionId,
		who: &AccountId,
	) -> Self::OwnedInCollectionIterator;
}

/// Trait for providing an interface to check the account's role within the collection.
pub trait InspectRole<AccountId>: Inspect<AccountId> {
	/// Returns `true` if `who` is the issuer of the `collection`.
	fn is_issuer(collection: &Self::CollectionId, who: &AccountId) -> bool;
	/// Returns `true` if `who` is the admin of the `collection`.
	fn is_admin(collection: &Self::CollectionId, who: &AccountId) -> bool;
	/// Returns `true` if `who` is the freezer of the `collection`.
	fn is_freezer(collection: &Self::CollectionId, who: &AccountId) -> bool;
}

/// Trait for providing the ability to create collections of nonfungible items.
pub trait Create<AccountId, CollectionConfig>: Inspect<AccountId> {
	/// Create a `collection` of nonfungible items to be owned by `who` and managed by `admin`.
	fn create_collection(
		who: &AccountId,
		admin: &AccountId,
		config: &CollectionConfig,
	) -> Result<Self::CollectionId, DispatchError>;
}

/// Trait for providing the ability to destroy collections of nonfungible items.
pub trait Destroy<AccountId>: Inspect<AccountId> {
	/// The witness data needed to destroy an item.
	type DestroyWitness: Parameter;

	/// Provide the appropriate witness data needed to destroy an item.
	fn get_destroy_witness(collection: &Self::CollectionId) -> Option<Self::DestroyWitness>;