1
1
//! The `ByteStr` and `ByteString` types and trait implementations.
2
2
3
+ // This could be more fine-grained.
4
+ #![ cfg( not( no_global_oom_handling) ) ]
5
+
3
6
use core:: borrow:: { Borrow , BorrowMut } ;
4
7
#[ unstable( feature = "bstr" , issue = "134915" ) ]
5
8
pub use core:: bstr:: ByteStr ;
@@ -17,8 +20,10 @@ use core::{fmt, hash};
17
20
use crate :: borrow:: { Cow , ToOwned } ;
18
21
#[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
19
22
use crate :: boxed:: Box ;
23
+ #[ cfg( not( no_rc) ) ]
20
24
use crate :: rc:: Rc ;
21
25
use crate :: string:: String ;
26
+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
22
27
use crate :: sync:: Arc ;
23
28
use crate :: vec:: Vec ;
24
29
@@ -649,6 +654,7 @@ impl From<Box<ByteStr>> for Box<[u8]> {
649
654
}
650
655
651
656
#[ unstable( feature = "bstr" , issue = "134915" ) ]
657
+ #[ cfg( not( no_rc) ) ]
652
658
impl From < Rc < [ u8 ] > > for Rc < ByteStr > {
653
659
#[ inline]
654
660
fn from ( s : Rc < [ u8 ] > ) -> Rc < ByteStr > {
@@ -658,6 +664,7 @@ impl From<Rc<[u8]>> for Rc<ByteStr> {
658
664
}
659
665
660
666
#[ unstable( feature = "bstr" , issue = "134915" ) ]
667
+ #[ cfg( not( no_rc) ) ]
661
668
impl From < Rc < ByteStr > > for Rc < [ u8 ] > {
662
669
#[ inline]
663
670
fn from ( s : Rc < ByteStr > ) -> Rc < [ u8 ] > {
@@ -667,6 +674,7 @@ impl From<Rc<ByteStr>> for Rc<[u8]> {
667
674
}
668
675
669
676
#[ unstable( feature = "bstr" , issue = "134915" ) ]
677
+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
670
678
impl From < Arc < [ u8 ] > > for Arc < ByteStr > {
671
679
#[ inline]
672
680
fn from ( s : Arc < [ u8 ] > ) -> Arc < ByteStr > {
@@ -676,6 +684,7 @@ impl From<Arc<[u8]>> for Arc<ByteStr> {
676
684
}
677
685
678
686
#[ unstable( feature = "bstr" , issue = "134915" ) ]
687
+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
679
688
impl From < Arc < ByteStr > > for Arc < [ u8 ] > {
680
689
#[ inline]
681
690
fn from ( s : Arc < ByteStr > ) -> Arc < [ u8 ] > {
0 commit comments