File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,23 @@ impl Board {
383
383
self
384
384
}
385
385
386
+ #[ inline]
387
+ pub fn is_empty ( & self ) -> bool {
388
+ self . occupied . is_empty ( )
389
+ }
390
+
391
+ pub fn first ( & self ) -> Option < ( Square , Piece ) > {
392
+ self . occupied
393
+ . first ( )
394
+ . and_then ( |sq| self . piece_at ( sq) . map ( |piece| ( sq, piece) ) )
395
+ }
396
+
397
+ pub fn last ( & self ) -> Option < ( Square , Piece ) > {
398
+ self . occupied
399
+ . last ( )
400
+ . and_then ( |sq| self . piece_at ( sq) . map ( |piece| ( sq, piece) ) )
401
+ }
402
+
386
403
pub fn pop_front ( & mut self ) -> Option < ( Square , Piece ) > {
387
404
self . occupied
388
405
. first ( )
@@ -532,6 +549,10 @@ impl Iterator for IntoIter {
532
549
let len = self . len ( ) ;
533
550
( len, Some ( len) )
534
551
}
552
+
553
+ fn last ( self ) -> Option < ( Square , Piece ) > {
554
+ self . inner . last ( )
555
+ }
535
556
}
536
557
537
558
impl ExactSizeIterator for IntoIter {
You can’t perform that action at this time.
0 commit comments