File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
src/constance_port_std/src Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ Simulator for running [ ` ::constance ` ] on a hosted environment
2
+
3
+ # Usage
4
+
5
+ ``` rust
6
+ #![feature(const_loop)]
7
+ #![feature(const_fn)]
8
+ #![feature(const_if_match)]
9
+ #![feature(const_mut_refs)]
10
+
11
+ // Require `unsafe` even in `unsafe fn` - highly recommended
12
+ #![feature(unsafe_block_in_unsafe_fn)]
13
+ #![deny(unsafe_op_in_unsafe_fn)]
14
+
15
+ use constance :: kernel :: Task ;
16
+
17
+ // Use the simulator port
18
+ constance_port_std :: use_port! (unsafe struct System );
19
+
20
+ const COTTAGE : () = constance :: build! (System , configure_app );
21
+
22
+ constance :: configure! {
23
+ const fn configure_app (_ : & mut CfgBuilder <System >) -> () {
24
+ new! { Task <_ >, start = task_body , priority = 1 , active = true };
25
+ }
26
+ }
27
+
28
+ fn task_body (_ : usize ) {
29
+ // The simulator initializes `env_logger` automatically
30
+ log :: warn! (" yay" );
31
+ }
32
+ ```
Original file line number Diff line number Diff line change 1
1
#![ feature( const_fn) ]
2
+ #![ feature( external_doc) ]
2
3
#![ feature( unsafe_block_in_unsafe_fn) ] // `unsafe fn` doesn't imply `unsafe {}`
4
+ #![ doc( include = "./lib.md" ) ]
3
5
#![ deny( unsafe_op_in_unsafe_fn) ]
4
6
use atomic_ref:: AtomicRef ;
5
7
use constance:: { prelude:: * , utils:: intrusive_list:: StaticListHead } ;
You can’t perform that action at this time.
0 commit comments