Added helper methods to Bundles. (#17464)
				
					
				
			Added `len`, `is_empty`, and `iter` methods to `Bundles`. Separated out from #17331. --------- Co-authored-by: shuo <shuoli84@gmail.com>
This commit is contained in:
		
							parent
							
								
									b34833f00c
								
							
						
					
					
						commit
						42b928b90e
					
				| @ -1473,6 +1473,21 @@ pub struct Bundles { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Bundles { | impl Bundles { | ||||||
|  |     /// The total number of [`Bundle`] registered in [`Storages`].
 | ||||||
|  |     pub fn len(&self) -> usize { | ||||||
|  |         self.bundle_infos.len() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /// Returns true if no [`Bundle`] registered in [`Storages`].
 | ||||||
|  |     pub fn is_empty(&self) -> bool { | ||||||
|  |         self.len() == 0 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /// Iterate over [`BundleInfo`].
 | ||||||
|  |     pub fn iter(&self) -> impl Iterator<Item = &BundleInfo> { | ||||||
|  |         self.bundle_infos.iter() | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /// Gets the metadata associated with a specific type of bundle.
 |     /// Gets the metadata associated with a specific type of bundle.
 | ||||||
|     /// Returns `None` if the bundle is not registered with the world.
 |     /// Returns `None` if the bundle is not registered with the world.
 | ||||||
|     #[inline] |     #[inline] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 AlephCubed
						AlephCubed