add methods to get reads and writes of Access<T> (#3166)
This makes it possible to e.g. show resource and component access on hover in [bevy_mod_debugdump](https://github.com/jakobhellermann/bevy_mod_debugdump/): 
This commit is contained in:
		
							parent
							
								
									0ee4195fb0
								
							
						
					
					
						commit
						a5ea38f75e
					
				@ -115,6 +115,18 @@ impl<T: SparseSetIndex> Access<T> {
 | 
			
		||||
            .map(SparseSetIndex::get_sparse_set_index)
 | 
			
		||||
            .collect()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Returns all read accesses.
 | 
			
		||||
    pub fn reads(&self) -> impl Iterator<Item = T> + '_ {
 | 
			
		||||
        self.reads_and_writes
 | 
			
		||||
            .difference(&self.writes)
 | 
			
		||||
            .map(T::get_sparse_set_index)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Returns all write accesses.
 | 
			
		||||
    pub fn writes(&self) -> impl Iterator<Item = T> + '_ {
 | 
			
		||||
        self.writes.ones().map(T::get_sparse_set_index)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Eq, PartialEq)]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user