Skip to content

Commit

Permalink
doc: Make all doctests buildable once more
Browse files Browse the repository at this point in the history
Merges: #110
  • Loading branch information
chrysn authored Aug 23, 2024
2 parents b8933a2 + ffccee8 commit 294d122
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/gpio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ impl GPIO {
/// Create a GPIO from its port and pin numbers
///
/// ```
/// # #![no_std]
/// # #![no_main]
/// # fn f() {
/// use riot_wrappers::gpio::GPIO;
/// let pin_c8 = GPIO::from_port_and_pin(3, 8);
/// # }
/// ```
///
/// See [from_c] for safety constraints.
Expand Down
3 changes: 2 additions & 1 deletion src/main_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ impl<F: Fn(StartToken) -> ((), EndToken)> UsableAsMain<[u8; 3]> for F {
///
/// ```
/// # #![no_std]
/// # use riot_wrappers::riot_main;
/// # #![no_main]
/// use riot_wrappers::riot_main;
/// riot_main!(main);
///
/// fn main() {
Expand Down
10 changes: 4 additions & 6 deletions src/msg/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,14 @@ pub trait MessageSemantics: Sized {
///
/// ```
/// # #![no_std]
/// # #![feature(start)]
/// # #[start]
/// # fn main(_argc: isize, _argv: *const *const u8) -> isize {
/// # use riot_wrappers::msg::v2::*;
/// # let message_semantics = unsafe { NoConfiguredMessages::new() };
/// # #![no_main]
/// # fn f() {
/// use riot_wrappers::msg::v2::*;
/// # let message_semantics = NoConfiguredMessages; // FIXME: constructing this should not be possible publicly
/// type NumberReceived = ReceivePort<u32, 1>;
/// type BoolReceived = ReceivePort<bool, 2>;
/// let (message_semantics, receive_num, send_num): (_, NumberReceived, _) = message_semantics.split_off();
/// let (message_semantics, receive_bool, send_bool): (_, BoolReceived, _) = message_semantics.split_off();
/// # 0
/// # }
/// ```
///
Expand Down

0 comments on commit 294d122

Please sign in to comment.