Skip to content

Commit 9f2ec44

Browse files
author
GueLaKais
committed
Added more comments
1 parent 262770f commit 9f2ec44

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rclrs/src/client.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@ where
9898
T: rosidl_runtime_rs::Service,
9999
{
100100
/// Creates a new client.
101+
///
102+
/// # Arguments
103+
///
104+
/// * `node_handle` - An `Arc` reference to the `NodeHandle` associated with this client.
105+
/// * `topic` - The name of the topic to which the client will send requests.
106+
///
107+
/// # Returns
108+
///
109+
/// A `Result` containing the newly created `Client` instance or an `RclrsError` if an error occurred
110+
/// during initialization.
111+
///
112+
/// # Errors
113+
///
114+
/// This function may return an error if:
115+
///
116+
/// - The `topic` string contains a null character.
117+
/// - The initialization of the underlying `rcl_client_t` instance fails.
118+
pub(crate) fn new(node_handle: Arc<NodeHandle>, topic: &str) -> Result<Self, RclrsError>
119+
// This uses pub(crate) visibility to avoid instantiating this struct outside
120+
// [`Node::create_client`], see the struct's documentation for the rationale
101121
pub(crate) fn new(node_handle: Arc<NodeHandle>, topic: &str) -> Result<Self, RclrsError>
102122
// This uses pub(crate) visibility to avoid instantiating this struct outside
103123
// [`Node::create_client`], see the struct's documentation for the rationale

0 commit comments

Comments
 (0)