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
@@ -664,6 +669,7 @@ impl From<Box<ByteStr>> for Box<[u8]> {
664
669
}
665
670
666
671
#[ unstable( feature = "bstr" , issue = "134915" ) ]
672
+ #[ cfg( not( no_rc) ) ]
667
673
impl From < Rc < [ u8 ] > > for Rc < ByteStr > {
668
674
#[ inline]
669
675
fn from ( s : Rc < [ u8 ] > ) -> Rc < ByteStr > {
@@ -673,6 +679,7 @@ impl From<Rc<[u8]>> for Rc<ByteStr> {
673
679
}
674
680
675
681
#[ unstable( feature = "bstr" , issue = "134915" ) ]
682
+ #[ cfg( not( no_rc) ) ]
676
683
impl From < Rc < ByteStr > > for Rc < [ u8 ] > {
677
684
#[ inline]
678
685
fn from ( s : Rc < ByteStr > ) -> Rc < [ u8 ] > {
@@ -682,6 +689,7 @@ impl From<Rc<ByteStr>> for Rc<[u8]> {
682
689
}
683
690
684
691
#[ unstable( feature = "bstr" , issue = "134915" ) ]
692
+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
685
693
impl From < Arc < [ u8 ] > > for Arc < ByteStr > {
686
694
#[ inline]
687
695
fn from ( s : Arc < [ u8 ] > ) -> Arc < ByteStr > {
@@ -691,6 +699,7 @@ impl From<Arc<[u8]>> for Arc<ByteStr> {
691
699
}
692
700
693
701
#[ unstable( feature = "bstr" , issue = "134915" ) ]
702
+ #[ cfg( all( not( no_rc) , not( no_sync) , target_has_atomic = "ptr" ) ) ]
694
703
impl From < Arc < ByteStr > > for Arc < [ u8 ] > {
695
704
#[ inline]
696
705
fn from ( s : Arc < ByteStr > ) -> Arc < [ u8 ] > {
0 commit comments