@@ -175,6 +175,8 @@ use crate::raw_vec::RawVec;
175175#[ cfg( not( no_global_oom_handling) ) ]
176176use crate :: str:: from_boxed_utf8_unchecked;
177177#[ cfg( not( no_global_oom_handling) ) ]
178+ use crate :: string:: String ;
179+ #[ cfg( not( no_global_oom_handling) ) ]
178180use crate :: vec:: Vec ;
179181
180182#[ unstable( feature = "thin_box" , issue = "92791" ) ]
@@ -1964,6 +1966,54 @@ impl<I> FromIterator<I> for Box<[I]> {
19641966 }
19651967}
19661968
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+
19672017#[ cfg( not( no_global_oom_handling) ) ]
19682018#[ stable( feature = "box_slice_clone" , since = "1.3.0" ) ]
19692019impl < T : Clone , A : Allocator + Clone > Clone for Box < [ T ] , A > {
0 commit comments