@@ -175,6 +175,8 @@ use crate::raw_vec::RawVec;
175
175
#[ cfg( not( no_global_oom_handling) ) ]
176
176
use crate :: str:: from_boxed_utf8_unchecked;
177
177
#[ cfg( not( no_global_oom_handling) ) ]
178
+ use crate :: string:: String ;
179
+ #[ cfg( not( no_global_oom_handling) ) ]
178
180
use crate :: vec:: Vec ;
179
181
180
182
#[ unstable( feature = "thin_box" , issue = "92791" ) ]
@@ -1964,6 +1966,54 @@ impl<I> FromIterator<I> for Box<[I]> {
1964
1966
}
1965
1967
}
1966
1968
1969
+ #[ cfg( not( no_global_oom_handling) ) ]
1970
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
1971
+ impl FromIterator < char > for Box < str > {
1972
+ fn from_iter < T : IntoIterator < Item = char > > ( iter : T ) -> Self {
1973
+ String :: from_iter ( iter) . into_boxed_str ( )
1974
+ }
1975
+ }
1976
+
1977
+ #[ cfg( not( no_global_oom_handling) ) ]
1978
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
1979
+ impl < ' a > FromIterator < & ' a char > for Box < str > {
1980
+ fn from_iter < T : IntoIterator < Item = & ' a char > > ( iter : T ) -> Self {
1981
+ String :: from_iter ( iter) . into_boxed_str ( )
1982
+ }
1983
+ }
1984
+
1985
+ #[ cfg( not( no_global_oom_handling) ) ]
1986
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
1987
+ impl < ' a > FromIterator < & ' a str > for Box < str > {
1988
+ fn from_iter < T : IntoIterator < Item = & ' a str > > ( iter : T ) -> Self {
1989
+ String :: from_iter ( iter) . into_boxed_str ( )
1990
+ }
1991
+ }
1992
+
1993
+ #[ cfg( not( no_global_oom_handling) ) ]
1994
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
1995
+ impl FromIterator < String > for Box < str > {
1996
+ fn from_iter < T : IntoIterator < Item = String > > ( iter : T ) -> Self {
1997
+ String :: from_iter ( iter) . into_boxed_str ( )
1998
+ }
1999
+ }
2000
+
2001
+ #[ cfg( not( no_global_oom_handling) ) ]
2002
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2003
+ impl < A : Allocator > FromIterator < Box < str , A > > for Box < str > {
2004
+ fn from_iter < T : IntoIterator < Item = Box < str , A > > > ( iter : T ) -> Self {
2005
+ String :: from_iter ( iter) . into_boxed_str ( )
2006
+ }
2007
+ }
2008
+
2009
+ #[ cfg( not( no_global_oom_handling) ) ]
2010
+ #[ stable( feature = "boxed_str_from_iter" , since = "CURRENT_RUSTC_VERSION" ) ]
2011
+ impl < ' a > FromIterator < Cow < ' a , str > > for Box < str > {
2012
+ fn from_iter < T : IntoIterator < Item = Cow < ' a , str > > > ( iter : T ) -> Self {
2013
+ String :: from_iter ( iter) . into_boxed_str ( )
2014
+ }
2015
+ }
2016
+
1967
2017
#[ cfg( not( no_global_oom_handling) ) ]
1968
2018
#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
1969
2019
impl < T : Clone , A : Allocator + Clone > Clone for Box < [ T ] , A > {
0 commit comments