11//! The `ByteStr` and `ByteString` types and trait implementations.
22
3+ // This could be more fine-grained.
4+ #![ cfg( not( no_global_oom_handling) ) ]
5+
36use core:: borrow:: { Borrow , BorrowMut } ;
47#[ unstable( feature = "bstr" , issue = "134915" ) ]
58pub use core:: bstr:: ByteStr ;
@@ -17,8 +20,10 @@ use core::{fmt, hash};
1720use crate :: borrow:: { Cow , ToOwned } ;
1821#[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
1922use crate :: boxed:: Box ;
23+ #[ cfg( not( no_rc) ) ]
2024use crate :: rc:: Rc ;
2125use crate :: string:: String ;
26+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
2227use crate :: sync:: Arc ;
2328use crate :: vec:: Vec ;
2429
@@ -649,6 +654,7 @@ impl From<Box<ByteStr>> for Box<[u8]> {
649654}
650655
651656#[ unstable( feature = "bstr" , issue = "134915" ) ]
657+ #[ cfg( not( no_rc) ) ]
652658impl From < Rc < [ u8 ] > > for Rc < ByteStr > {
653659 #[ inline]
654660 fn from ( s : Rc < [ u8 ] > ) -> Rc < ByteStr > {
@@ -658,6 +664,7 @@ impl From<Rc<[u8]>> for Rc<ByteStr> {
658664}
659665
660666#[ unstable( feature = "bstr" , issue = "134915" ) ]
667+ #[ cfg( not( no_rc) ) ]
661668impl From < Rc < ByteStr > > for Rc < [ u8 ] > {
662669 #[ inline]
663670 fn from ( s : Rc < ByteStr > ) -> Rc < [ u8 ] > {
@@ -667,6 +674,7 @@ impl From<Rc<ByteStr>> for Rc<[u8]> {
667674}
668675
669676#[ unstable( feature = "bstr" , issue = "134915" ) ]
677+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
670678impl From < Arc < [ u8 ] > > for Arc < ByteStr > {
671679 #[ inline]
672680 fn from ( s : Arc < [ u8 ] > ) -> Arc < ByteStr > {
@@ -676,6 +684,7 @@ impl From<Arc<[u8]>> for Arc<ByteStr> {
676684}
677685
678686#[ unstable( feature = "bstr" , issue = "134915" ) ]
687+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
679688impl From < Arc < ByteStr > > for Arc < [ u8 ] > {
680689 #[ inline]
681690 fn from ( s : Arc < ByteStr > ) -> Arc < [ u8 ] > {
0 commit comments