pub fn add_subscription(
        &mut self,
        subscription: &Weak<dyn SubscriptionBase>,
    ) -> Result<(), WaitSetErrorResponse> {
        if let Some(subscription) = subscription.upgrade() {
            let subscription_handle = &mut *subscription.handle().lock();
            unsafe {
                return to_rcl_result(rcl_wait_set_add_subscription(
                    self.wait_set.borrow_mut() as *mut _,
                    subscription_handle as *const _,
                    core::ptr::null_mut(),
                ))
                .map_err(WaitSetErrorResponse::ReturnCode);
            }
        } else {
            Err(WaitSetErrorResponse::DroppedSubscription)
        }
    }
/// Adds a subscription to the WaitSet
///
/// # Errors
/// - `WaitSetError::DroppedSubscription` if the passed weak pointer refers to a dropped subscription
/// - `WaitSetError::RclError` for any `rcl` errors that occur during the process
Adds a subscription to the WaitSet
Adds a subscription to the WaitSet
pub fn add_subscription(
        &mut self,
        subscription: &Weak<dyn SubscriptionBase>,
    ) -> Result<(), WaitSetErrorResponse> {
        if let Some(subscription) = subscription.upgrade() {
            let subscription_handle = &mut *subscription.handle().lock();
            unsafe {
                return to_rcl_result(rcl_wait_set_add_subscription(
                    self.wait_set.borrow_mut() as *mut _,
                    subscription_handle as *const _,
                    core::ptr::null_mut(),
                ))
                .map_err(WaitSetErrorResponse::ReturnCode);
            }
        } else {
            Err(WaitSetErrorResponse::DroppedSubscription)
        }
    }
pub fn add_subscription ( & mut self , subscription : & Weak < dyn SubscriptionBase > , ) -> Result < ( ) , WaitSetErrorResponse > { if let Some ( subscription ) = subscription . upgrade ( ) { let subscription_handle = & mut * subscription . handle ( ) . lock ( ) ; unsafe { return to_rcl_result ( rcl_wait_set_add_subscription ( self . wait_set . borrow_mut ( ) as * mut _ , subscription_handle as * const _ , core :: ptr :: null_mut ( ) , ) ) . map_err ( WaitSetErrorResponse :: ReturnCode ) ; } } else { Err ( WaitSetErrorResponse :: DroppedSubscription ) } }
Adds a subscription to the WaitSet
Adds a subscription to the WaitSet
&mut self
subscription
&Weak<dyn SubscriptionBase>
&mut self
subscription
&Weak<dyn SubscriptionBase>
errors
`WaitSetError::DroppedSubscription` if the passed weak pointer refers to a dropped subscription
`WaitSetError::RclError` for any `rcl` errors that occur during the process
` WaitSetError :: DroppedSubscription ` if the passed weak pointer refers to a dropped subscription ` WaitSetError :: RclError ` for any ` rcl ` errors that occur during the process