Skip to content

Commit 67d1e2a

Browse files
author
GueLaKais
committed
Let's drive on the clock documentation!
I wanted a long time ago to comment this clock!
1 parent 9a03faf commit 67d1e2a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

rclrs/src/clock.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ pub enum ClockType {
1515
}
1616

1717
impl From<ClockType> for rcl_clock_type_t {
18+
/// Converts a `ClockType` enum variant into the corresponding `rcl_clock_type_t` value.
19+
///
20+
/// This implementation maps each `ClockType` variant to the corresponding `rcl_clock_type_t`
21+
/// value defined in the ROS Client Library (RCL) bindings.
22+
///
23+
/// # Examples
24+
///
25+
/// ```
26+
/// use rclrs::clock::ClockType;
27+
///
28+
/// let ros_time = ClockType::RosTime;
29+
/// let rcl_ros_time: rcl_clock_type_t = ros_time.into();
30+
/// assert_eq!(rcl_ros_time, rcl_clock_type_t::RCL_ROS_TIME);
31+
/// ```
1832
fn from(clock_type: ClockType) -> Self {
1933
match clock_type {
2034
ClockType::RosTime => rcl_clock_type_t::RCL_ROS_TIME,

0 commit comments

Comments
 (0)