31
31
//! This API is completely unstable and subject to change.
32
32
33
33
#![ doc( html_root_url = "https://doc.rust-lang.org/nightly/" ) ]
34
+ #![ no_std]
34
35
#![ forbid( unsafe_code) ]
35
36
36
37
#![ feature( nll) ]
37
38
38
- use std:: cmp:: Ordering ;
39
- use std:: fmt;
40
- use std:: ops:: { Neg , Add , Sub , Mul , Div , Rem } ;
41
- use std:: ops:: { AddAssign , SubAssign , MulAssign , DivAssign , RemAssign } ;
42
- use std:: str:: FromStr ;
39
+ #[ macro_use]
40
+ extern crate alloc;
41
+
42
+ use core:: cmp:: Ordering ;
43
+ use core:: fmt;
44
+ use core:: ops:: { Neg , Add , Sub , Mul , Div , Rem } ;
45
+ use core:: ops:: { AddAssign , SubAssign , MulAssign , DivAssign , RemAssign } ;
46
+ use core:: str:: FromStr ;
43
47
44
48
bitflags:: bitflags! {
45
49
/// IEEE-754R 7: Default exception handling.
@@ -587,7 +591,7 @@ macro_rules! float_common_impls {
587
591
}
588
592
}
589
593
590
- impl <$t> :: std :: str :: FromStr for $ty<$t> where Self : Float {
594
+ impl <$t> :: core :: str :: FromStr for $ty<$t> where Self : Float {
591
595
type Err = ParseError ;
592
596
fn from_str( s: & str ) -> Result <Self , ParseError > {
593
597
Self :: from_str_r( s, Round :: NearestTiesToEven ) . map( |x| x. value)
@@ -596,66 +600,66 @@ macro_rules! float_common_impls {
596
600
597
601
// Rounding ties to the nearest even, by default.
598
602
599
- impl <$t> :: std :: ops:: Add for $ty<$t> where Self : Float {
603
+ impl <$t> :: core :: ops:: Add for $ty<$t> where Self : Float {
600
604
type Output = StatusAnd <Self >;
601
605
fn add( self , rhs: Self ) -> StatusAnd <Self > {
602
606
self . add_r( rhs, Round :: NearestTiesToEven )
603
607
}
604
608
}
605
609
606
- impl <$t> :: std :: ops:: Sub for $ty<$t> where Self : Float {
610
+ impl <$t> :: core :: ops:: Sub for $ty<$t> where Self : Float {
607
611
type Output = StatusAnd <Self >;
608
612
fn sub( self , rhs: Self ) -> StatusAnd <Self > {
609
613
self . sub_r( rhs, Round :: NearestTiesToEven )
610
614
}
611
615
}
612
616
613
- impl <$t> :: std :: ops:: Mul for $ty<$t> where Self : Float {
617
+ impl <$t> :: core :: ops:: Mul for $ty<$t> where Self : Float {
614
618
type Output = StatusAnd <Self >;
615
619
fn mul( self , rhs: Self ) -> StatusAnd <Self > {
616
620
self . mul_r( rhs, Round :: NearestTiesToEven )
617
621
}
618
622
}
619
623
620
- impl <$t> :: std :: ops:: Div for $ty<$t> where Self : Float {
624
+ impl <$t> :: core :: ops:: Div for $ty<$t> where Self : Float {
621
625
type Output = StatusAnd <Self >;
622
626
fn div( self , rhs: Self ) -> StatusAnd <Self > {
623
627
self . div_r( rhs, Round :: NearestTiesToEven )
624
628
}
625
629
}
626
630
627
- impl <$t> :: std :: ops:: Rem for $ty<$t> where Self : Float {
631
+ impl <$t> :: core :: ops:: Rem for $ty<$t> where Self : Float {
628
632
type Output = StatusAnd <Self >;
629
633
fn rem( self , rhs: Self ) -> StatusAnd <Self > {
630
634
self . c_fmod( rhs)
631
635
}
632
636
}
633
637
634
- impl <$t> :: std :: ops:: AddAssign for $ty<$t> where Self : Float {
638
+ impl <$t> :: core :: ops:: AddAssign for $ty<$t> where Self : Float {
635
639
fn add_assign( & mut self , rhs: Self ) {
636
640
* self = ( * self + rhs) . value;
637
641
}
638
642
}
639
643
640
- impl <$t> :: std :: ops:: SubAssign for $ty<$t> where Self : Float {
644
+ impl <$t> :: core :: ops:: SubAssign for $ty<$t> where Self : Float {
641
645
fn sub_assign( & mut self , rhs: Self ) {
642
646
* self = ( * self - rhs) . value;
643
647
}
644
648
}
645
649
646
- impl <$t> :: std :: ops:: MulAssign for $ty<$t> where Self : Float {
650
+ impl <$t> :: core :: ops:: MulAssign for $ty<$t> where Self : Float {
647
651
fn mul_assign( & mut self , rhs: Self ) {
648
652
* self = ( * self * rhs) . value;
649
653
}
650
654
}
651
655
652
- impl <$t> :: std :: ops:: DivAssign for $ty<$t> where Self : Float {
656
+ impl <$t> :: core :: ops:: DivAssign for $ty<$t> where Self : Float {
653
657
fn div_assign( & mut self , rhs: Self ) {
654
658
* self = ( * self / rhs) . value;
655
659
}
656
660
}
657
661
658
- impl <$t> :: std :: ops:: RemAssign for $ty<$t> where Self : Float {
662
+ impl <$t> :: core :: ops:: RemAssign for $ty<$t> where Self : Float {
659
663
fn rem_assign( & mut self , rhs: Self ) {
660
664
* self = ( * self % rhs) . value;
661
665
}
0 commit comments