File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ use crate::lib::std::collections::HashMap;
3333#[ cfg( feature = "std" ) ]
3434use crate :: lib:: std:: collections:: HashSet ;
3535#[ cfg( feature = "alloc" ) ]
36+ use crate :: lib:: std:: collections:: VecDeque ;
37+ #[ cfg( feature = "alloc" ) ]
3638use crate :: lib:: std:: string:: String ;
3739#[ cfg( feature = "alloc" ) ]
3840use crate :: lib:: std:: vec:: Vec ;
@@ -1549,6 +1551,21 @@ where
15491551 }
15501552}
15511553
1554+ #[ cfg( feature = "alloc" ) ]
1555+ impl < ' i , T : Clone > Accumulate < & ' i [ T ] > for VecDeque < T > {
1556+ #[ inline( always) ]
1557+ fn initial ( capacity : Option < usize > ) -> Self {
1558+ match capacity {
1559+ Some ( capacity) => VecDeque :: with_capacity ( clamp_capacity :: < T > ( capacity) ) ,
1560+ None => VecDeque :: new ( ) ,
1561+ }
1562+ }
1563+ #[ inline( always) ]
1564+ fn accumulate ( & mut self , acc : & ' i [ T ] ) {
1565+ self . extend ( acc. iter ( ) . cloned ( ) ) ;
1566+ }
1567+ }
1568+
15521569#[ cfg( feature = "alloc" ) ]
15531570#[ inline]
15541571pub ( crate ) fn clamp_capacity < T > ( capacity : usize ) -> usize {
You can’t perform that action at this time.
0 commit comments