File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 47
47
- name : Install thumbv7em-none-eabihf target
48
48
run : rustup target add thumbv7em-none-eabihf
49
49
50
- - name : Run cargo build
50
+ - name : Run cargo build (no_std)
51
51
uses : actions-rs/cargo@v1
52
52
env :
53
53
RUSTFLAGS : -D warnings
61
61
RUSTFLAGS : -D warnings
62
62
with :
63
63
command : build
64
- args : --all-features --release --target thumbv7em-none-eabihf
64
+ args : --all-features --release
65
65
66
66
test :
67
67
name : Test Suite
Original file line number Diff line number Diff line change @@ -25,3 +25,4 @@ features = ["vector"]
25
25
[features ]
26
26
default = [" orientation" ]
27
27
orientation = []
28
+ std = []
Original file line number Diff line number Diff line change @@ -100,3 +100,25 @@ where
100
100
Self :: new_with_cause ( ErrorKind :: Bus , cause)
101
101
}
102
102
}
103
+
104
+ #[ cfg( feature = "std" ) ]
105
+ impl < E > std:: error:: Error for Error < E >
106
+ where
107
+ E : Debug + std:: error:: Error + ' static ,
108
+ {
109
+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
110
+ self . cause
111
+ . as_ref ( )
112
+ . map ( |cause| cause as & ( dyn std:: error:: Error + ' static ) )
113
+ }
114
+ }
115
+
116
+ #[ cfg( feature = "std" ) ]
117
+ impl < E > Display for Error < E >
118
+ where
119
+ E : Debug ,
120
+ {
121
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
122
+ write ! ( f, "{}" , self . kind)
123
+ }
124
+ }
Original file line number Diff line number Diff line change 39
39
#![ forbid( unsafe_code) ]
40
40
#![ warn( missing_docs, rust_2018_idioms, unused_qualifications) ]
41
41
42
+ #[ cfg( feature = "std" ) ]
43
+ extern crate std;
44
+
42
45
mod accelerometer;
43
46
pub mod error;
44
47
#[ cfg( feature = "orientation" ) ]
You can’t perform that action at this time.
0 commit comments