Expand description
Mynewt Macros for calling Mynewt APIs . Import this crate into a source code crate and check the expanded macros using:
clear ; cargo rustc -- -Z unstable-options --pretty expanded | head -20
Macros§
- init_
strn - Initialise a null-terminated bytestring
Strn
that’s suitable for passing to Mynewt APIsinit_strn!("network")
expands toStrn{ rep: ByteStr(b"network\0") }
Used like this: - out
- Given a static mutable variable, return an unsafe mutable pointer that’s suitable for passing to Mynewt APIs for writing output.
out!(NETWORK_TASK)
expands tounsafe { &mut NETWORK_TASK }
- strn
- Create a
Strn
containing a null-terminated byte string that’s suitable for passing to Mynewt APIs.strn!("network")
expands to&Strn::new( b"network\0" )
.strn!(())
expands to&Strn::new( b"\0" )
. For macro calls likestrn!( stringify!( value ) )
, return&Strn::new( b"value\0" )
. For complex macro calls likestrn!( $crate::parse!(@ json device_id) )
, return the parameter as is. - try_
cbor - Transform a block of CBOR encoding calls by adding error checking. All lines must terminate with
;
Attribute Macros§
- infer_
type - Given a Rust function definition, infer the placeholder types in the function
- safe_
wrap - Given an
extern "C"
block of function declarations, generate the safe wrapper for the function