@@ -184,17 +184,11 @@ impl Node {
184184 ///
185185 /// [1]: crate::Client
186186 // TODO: make client's lifetime depend on node's lifetime
187- pub fn create_client < T > (
188- & mut self ,
189- topic : & str ,
190- ) -> Result < Arc < crate :: node:: client:: Client < T > > , RclrsError >
187+ pub fn create_client < T > ( & mut self , topic : & str ) -> Result < Arc < Client < T > > , RclrsError >
191188 where
192189 T : rosidl_runtime_rs:: Service ,
193190 {
194- let client = Arc :: new ( crate :: node:: client:: Client :: < T > :: new ( self , topic) ?) ;
195- self . clients
196- . push ( Arc :: downgrade ( & client) as Weak < dyn ClientBase > ) ;
197- Ok ( client)
191+ Client :: < T > :: new ( self , topic)
198192 }
199193
200194 /// Creates a [`Publisher`][1].
@@ -220,17 +214,12 @@ impl Node {
220214 & mut self ,
221215 topic : & str ,
222216 callback : F ,
223- ) -> Result < Arc < crate :: node :: service :: Service < T > > , RclrsError >
217+ ) -> Result < Arc < Service < T > > , RclrsError >
224218 where
225219 T : rosidl_runtime_rs:: Service ,
226220 F : Fn ( & rmw_request_id_t , T :: Request ) -> T :: Response + ' static + Send ,
227221 {
228- let service = Arc :: new ( crate :: node:: service:: Service :: < T > :: new (
229- self , topic, callback,
230- ) ?) ;
231- self . services
232- . push ( Arc :: downgrade ( & service) as Weak < dyn ServiceBase > ) ;
233- Ok ( service)
222+ Service :: < T > :: new ( self , topic, callback)
234223 }
235224
236225 /// Creates a [`Subscription`][1].
@@ -247,10 +236,7 @@ impl Node {
247236 T : Message ,
248237 F : FnMut ( T ) + ' static + Send ,
249238 {
250- let subscription = Arc :: new ( Subscription :: < T > :: new ( self , topic, qos, callback) ?) ;
251- self . subscriptions
252- . push ( Arc :: downgrade ( & subscription) as Weak < dyn SubscriptionBase > ) ;
253- Ok ( subscription)
239+ Subscription :: new ( self , topic, qos, callback)
254240 }
255241
256242 /// Returns the subscriptions that have not been dropped yet.
0 commit comments