[core] Implement Square::file_rank()
Returns a tuple of the square's file and rank.
This commit is contained in:
		
							parent
							
								
									a8034c79aa
								
							
						
					
					
						commit
						a5e8f33afe
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -208,6 +208,10 @@ impl Square {
 | 
			
		|||
        unsafe { Rank::new_unchecked((self as u8) >> 3) }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn file_rank(&self) -> (File, Rank) {
 | 
			
		||||
        (self.file(), self.rank())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn neighbor(self, direction: Direction) -> Option<Square> {
 | 
			
		||||
        let index: u8 = self as u8;
 | 
			
		||||
        let dir: i8 = direction.to_offset();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue