File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -270,10 +270,10 @@ jobs:
270270 grep '] ok 1 - rust_kernel_doctests$' qemu-stdout.log
271271
272272 - run : |
273- grep '] rust_minimal: Rust minimal sample (init)$' qemu-stdout.log
274- grep '] rust_minimal: Am I built-in? false$' qemu-stdout.log
275- grep '] rust_minimal: My message is on the heap! $' qemu-stdout.log
276- grep '] rust_minimal: Rust minimal sample (exit)$' qemu-stdout.log
273+ grep '] rust_minimal: Rust minimal sample (init)$' qemu-stdout.log
274+ grep '] rust_minimal: Am I built-in? false$' qemu-stdout.log
275+ grep '] rust_minimal: My numbers are \[72, 108, 200] $' qemu-stdout.log
276+ grep '] rust_minimal: Rust minimal sample (exit)$' qemu-stdout.log
277277
278278 - run : |
279279 grep '] rust_print: Rust printing macros sample (init)$' qemu-stdout.log
Original file line number Diff line number Diff line change @@ -13,23 +13,26 @@ module! {
1313}
1414
1515struct RustMinimal {
16- message : String ,
16+ numbers : Vec < i32 > ,
1717}
1818
1919impl kernel:: Module for RustMinimal {
2020 fn init ( _name : & ' static CStr , _module : & ' static ThisModule ) -> Result < Self > {
2121 pr_info ! ( "Rust minimal sample (init)\n " ) ;
2222 pr_info ! ( "Am I built-in? {}\n " , !cfg!( MODULE ) ) ;
2323
24- Ok ( RustMinimal {
25- message : "on the heap!" . try_to_owned ( ) ?,
26- } )
24+ let mut numbers = Vec :: new ( ) ;
25+ numbers. try_push ( 72 ) ?;
26+ numbers. try_push ( 108 ) ?;
27+ numbers. try_push ( 200 ) ?;
28+
29+ Ok ( RustMinimal { numbers } )
2730 }
2831}
2932
3033impl Drop for RustMinimal {
3134 fn drop ( & mut self ) {
32- pr_info ! ( "My message is { }\n " , self . message ) ;
35+ pr_info ! ( "My numbers are {:? }\n " , self . numbers ) ;
3336 pr_info ! ( "Rust minimal sample (exit)\n " ) ;
3437 }
3538}
You can’t perform that action at this time.
0 commit comments