Skip to content

Commit 2d424f0

Browse files
committed
Fill in documentation
Signed-off-by: Michael X. Grey <[email protected]>
1 parent e38144a commit 2d424f0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

rclrs/src/timer/timer_callback.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub enum AnyTimerCallback {
1717
/// callbacks can take the current [`Time`] as an argument, or [`Time`], or take
1818
/// no argument at all.
1919
pub trait TimerCallRepeating<Args>: Send + 'static {
20+
/// Convert a suitable object into a repeating timer callback
2021
fn into_repeating_timer_callback(self) -> AnyTimerCallback;
2122
}
2223

@@ -42,6 +43,7 @@ where
4243
/// callbacks can take the current [`Time`] as an argument, or [`Time`], or take
4344
/// no argument at all.
4445
pub trait TimerCallOnce<Args>: Send + 'static {
46+
/// Convert a suitable object into a one-shot timer callback
4547
fn into_oneshot_timer_callback(self) -> AnyTimerCallback;
4648
}
4749

rclrs/src/timer/timer_options.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ use crate::{Clock, Node};
99
#[derive(Debug, Clone, Copy)]
1010
#[non_exhaustive]
1111
pub struct TimerOptions<'a> {
12+
/// The period of the timer's interval
1213
pub period: Duration,
14+
/// The clock that the timer will reference for its intervals
1315
pub clock: TimerClock<'a>,
1416
}
1517

1618
impl TimerOptions<'_> {
19+
/// Make a new timer with a certain interval period, with all other options
20+
/// as default.
1721
pub fn new(period: Duration) -> Self {
1822
Self {
1923
period,
@@ -22,7 +26,10 @@ impl TimerOptions<'_> {
2226
}
2327
}
2428

29+
/// Trait to implicitly convert a suitable object into [`TimerOptions`].
2530
pub trait IntoTimerOptions<'a>: Sized {
31+
/// Convert a suitable object into [`TimerOptions`]. This can be used on
32+
/// [`Duration`] or [`TimerOptions`] itself.
2633
fn into_timer_options(self) -> TimerOptions<'a>;
2734

2835
/// Use [`std::time::Instant`] for the timer. This the default so you

0 commit comments

Comments
 (0)