Skip to content

Commit a0a8717

Browse files
author
GueLaKais
committed
Added comments to Function
To be honest, I still don't understand exactly what's happening here. All I know is that it's at least somewhat understandable what's going on here.
1 parent 4fbae08 commit a0a8717

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rosidl_runtime_rs/src/sequence.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ macro_rules! impl_sequence_alloc_for_primitive_type {
559559
ret
560560
}
561561
}
562+
562563
/// Finalizes a sequence, freeing any associated resources.
563564
///
564565
/// # Safety
@@ -573,6 +574,22 @@ macro_rules! impl_sequence_alloc_for_primitive_type {
573574
// SAFETY: There are no special preconditions to the sequence_fini function.
574575
unsafe { $fini_func(seq as *mut _) }
575576
}
577+
578+
/// Copies the contents of one sequence to another.
579+
///
580+
/// # Safety
581+
///
582+
/// This function is unsafe because it calls an unsafe function `$copy_func`.
583+
/// The caller must ensure that `$copy_func` is safe to call with the provided arguments.
584+
///
585+
/// # Arguments
586+
///
587+
/// * `in_seq` - A reference to the sequence to be copied from.
588+
/// * `out_seq` - A mutable reference to the sequence to be copied to.
589+
///
590+
/// # Returns
591+
///
592+
/// `true` if the copy was successful, `false` otherwise.
576593
fn sequence_copy(in_seq: &Sequence<Self>, out_seq: &mut Sequence<Self>) -> bool {
577594
// SAFETY: There are no special preconditions to the sequence_copy function.
578595
unsafe { $copy_func(in_seq as *const _, out_seq as *mut _) }

0 commit comments

Comments
 (0)