@@ -94,6 +94,11 @@ pub trait StreamingIterator {
94
94
( 0 , None )
95
95
}
96
96
97
+ /// Checks if `get()` will return `None`.
98
+ fn is_done ( & self ) -> bool {
99
+ self . get ( ) . is_none ( )
100
+ }
101
+
97
102
/// Determines if all elements of the iterator satisfy a predicate.
98
103
#[ inline]
99
104
fn all < F > ( & mut self , mut f : F ) -> bool
@@ -409,11 +414,6 @@ pub trait StreamingIterator {
409
414
Rev ( self )
410
415
}
411
416
412
- /// Checks if `get()` will return `None`.
413
- fn is_done ( & self ) -> bool {
414
- self . get ( ) . is_none ( )
415
- }
416
-
417
417
/// Reduces the iterator's elements to a single, final value.
418
418
#[ inline]
419
419
fn fold < B , F > ( mut self , init : B , mut f : F ) -> B
@@ -450,6 +450,11 @@ where
450
450
( * * self ) . advance ( )
451
451
}
452
452
453
+ #[ inline]
454
+ fn is_done ( & self ) -> bool {
455
+ ( * * self ) . is_done ( )
456
+ }
457
+
453
458
#[ inline]
454
459
fn get ( & self ) -> Option < & Self :: Item > {
455
460
( * * self ) . get ( )
@@ -478,6 +483,11 @@ where
478
483
( * * self ) . advance ( )
479
484
}
480
485
486
+ #[ inline]
487
+ fn is_done ( & self ) -> bool {
488
+ ( * * self ) . is_done ( )
489
+ }
490
+
481
491
#[ inline]
482
492
fn get ( & self ) -> Option < & Self :: Item > {
483
493
( * * self ) . get ( )
@@ -575,6 +585,16 @@ where
575
585
}
576
586
}
577
587
588
+ #[ inline]
589
+ fn is_done ( & self ) -> bool {
590
+ use ChainState :: * ;
591
+
592
+ match self . state {
593
+ BothForward | Front => self . a . is_done ( ) ,
594
+ BothBackward | Back => self . b . is_done ( ) ,
595
+ }
596
+ }
597
+
578
598
#[ inline]
579
599
fn get ( & self ) -> Option < & Self :: Item > {
580
600
use ChainState :: * ;
@@ -712,6 +732,11 @@ where
712
732
}
713
733
}
714
734
735
+ #[ inline]
736
+ fn is_done ( & self ) -> bool {
737
+ self . it . is_done ( )
738
+ }
739
+
715
740
#[ inline]
716
741
fn get ( & self ) -> Option < & I :: Item > {
717
742
self . it . get ( )
@@ -898,6 +923,14 @@ where
898
923
}
899
924
}
900
925
926
+ #[ inline]
927
+ fn is_done ( & self ) -> bool {
928
+ match self . sub_iter {
929
+ Some ( ref iter) => iter. is_done ( ) ,
930
+ None => true ,
931
+ }
932
+ }
933
+
901
934
#[ inline]
902
935
fn get ( & self ) -> Option < & Self :: Item > {
903
936
self . sub_iter . as_ref ( ) . and_then ( J :: get)
@@ -1014,6 +1047,14 @@ where
1014
1047
}
1015
1048
}
1016
1049
1050
+ #[ inline]
1051
+ fn is_done ( & self ) -> bool {
1052
+ match self . state {
1053
+ FuseState :: Start | FuseState :: End => true ,
1054
+ FuseState :: Middle => self . it . is_done ( ) ,
1055
+ }
1056
+ }
1057
+
1017
1058
#[ inline]
1018
1059
fn get ( & self ) -> Option < & I :: Item > {
1019
1060
match self . state {
@@ -1091,6 +1132,11 @@ where
1091
1132
}
1092
1133
}
1093
1134
1135
+ #[ inline]
1136
+ fn is_done ( & self ) -> bool {
1137
+ self . it . is_done ( )
1138
+ }
1139
+
1094
1140
fn get ( & self ) -> Option < & Self :: Item > {
1095
1141
self . it . get ( )
1096
1142
}
@@ -1265,6 +1311,11 @@ where
1265
1311
self . it . advance ( ) ;
1266
1312
}
1267
1313
1314
+ #[ inline]
1315
+ fn is_done ( & self ) -> bool {
1316
+ self . it . is_done ( )
1317
+ }
1318
+
1268
1319
#[ inline]
1269
1320
fn get ( & self ) -> Option < & B > {
1270
1321
self . it . get ( ) . map ( & self . f )
@@ -1280,11 +1331,6 @@ where
1280
1331
self . it . next ( ) . map ( & self . f )
1281
1332
}
1282
1333
1283
- #[ inline]
1284
- fn is_done ( & self ) -> bool {
1285
- self . it . get ( ) . is_none ( )
1286
- }
1287
-
1288
1334
#[ inline]
1289
1335
fn fold < Acc , Fold > ( self , init : Acc , mut fold : Fold ) -> Acc
1290
1336
where
@@ -1363,6 +1409,11 @@ where
1363
1409
self . n = 0 ;
1364
1410
}
1365
1411
1412
+ #[ inline]
1413
+ fn is_done ( & self ) -> bool {
1414
+ self . it . is_done ( )
1415
+ }
1416
+
1366
1417
#[ inline]
1367
1418
fn get ( & self ) -> Option < & I :: Item > {
1368
1419
self . it . get ( )
@@ -1419,6 +1470,11 @@ where
1419
1470
}
1420
1471
}
1421
1472
1473
+ #[ inline]
1474
+ fn is_done ( & self ) -> bool {
1475
+ self . it . is_done ( )
1476
+ }
1477
+
1422
1478
#[ inline]
1423
1479
fn get ( & self ) -> Option < & I :: Item > {
1424
1480
self . it . get ( )
@@ -1470,6 +1526,11 @@ where
1470
1526
}
1471
1527
}
1472
1528
1529
+ #[ inline]
1530
+ fn is_done ( & self ) -> bool {
1531
+ self . done || self . it . is_done ( )
1532
+ }
1533
+
1473
1534
#[ inline]
1474
1535
fn get ( & self ) -> Option < & I :: Item > {
1475
1536
if self . done {
@@ -1513,6 +1574,11 @@ where
1513
1574
}
1514
1575
}
1515
1576
1577
+ #[ inline]
1578
+ fn is_done ( & self ) -> bool {
1579
+ self . done || self . it . is_done ( )
1580
+ }
1581
+
1516
1582
#[ inline]
1517
1583
fn get ( & self ) -> Option < & I :: Item > {
1518
1584
if self . done {
@@ -1566,6 +1632,11 @@ where
1566
1632
self . 0 . advance_back ( ) ;
1567
1633
}
1568
1634
1635
+ #[ inline]
1636
+ fn is_done ( & self ) -> bool {
1637
+ self . 0 . is_done ( )
1638
+ }
1639
+
1569
1640
#[ inline]
1570
1641
fn get ( & self ) -> Option < & I :: Item > {
1571
1642
self . 0 . get ( )
0 commit comments