File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
ledger_device_sdk/src/nbgl Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ use alloc::ffi::CString;
7
7
/// 800 ms, provided the IO event loop is running to process TickerEvents.
8
8
#[ derive( Debug , Default ) ]
9
9
pub struct NbglSpinner {
10
- text : [ Option < CString > ; 2 ] ,
10
+ text : [ CString ; 2 ] ,
11
11
write_idx : usize ,
12
12
read_idx : usize ,
13
13
}
14
14
15
15
impl NbglSpinner {
16
16
pub fn new ( ) -> NbglSpinner {
17
17
NbglSpinner {
18
- text : [ None , None ] ,
18
+ text : [ CString :: default ( ) , CString :: default ( ) ] ,
19
19
write_idx : 0 ,
20
20
read_idx : 0 ,
21
21
}
@@ -24,13 +24,11 @@ impl NbglSpinner {
24
24
/// Shows the spinner with the current text.
25
25
/// Every call make the spinner "turn" to the next text.
26
26
pub fn show ( & mut self , text : & str ) {
27
- self . text [ self . write_idx ] = Some ( CString :: new ( text) . unwrap ( ) ) ;
27
+ self . text [ self . write_idx ] = CString :: new ( text) . unwrap ( ) ;
28
28
self . read_idx = self . write_idx ;
29
29
self . write_idx = ( self . write_idx + 1 ) % 2 ;
30
30
unsafe {
31
- nbgl_useCaseSpinner (
32
- self . text [ self . read_idx ] . as_ref ( ) . unwrap ( ) . as_ptr ( ) as * const c_char
33
- ) ;
31
+ nbgl_useCaseSpinner ( self . text [ self . read_idx ] . as_ptr ( ) as * const c_char ) ;
34
32
}
35
33
}
36
34
}
You can’t perform that action at this time.
0 commit comments