@@ -6,9 +6,8 @@ use super::{
6
6
DynamicMessageMetadata , MessageTypeName ,
7
7
} ;
8
8
use crate :: error:: { RclrsError , ToResult } ;
9
- use crate :: qos:: QoSProfile ;
10
9
use crate :: rcl_bindings:: * ;
11
- use crate :: { ENTITY_LIFECYCLE_MUTEX , PublisherHandle , NodeHandle } ;
10
+ use crate :: { NodeHandle , PublisherHandle , PublisherOptions , ENTITY_LIFECYCLE_MUTEX } ;
12
11
13
12
/// Struct for sending messages of type `T`.
14
13
///
@@ -28,25 +27,18 @@ pub struct DynamicPublisher {
28
27
type_support_library : Arc < libloading:: Library > ,
29
28
}
30
29
31
- // SAFETY: The functions accessing this type, including drop(), shouldn't care about the thread
32
- // they are running in. Therefore, this type can be safely sent to another thread.
33
- // unsafe impl Send for DynamicPublisher {}
34
- // SAFETY: The type_support_ptr prevents the default Sync impl.
35
- // rosidl_message_type_support_t is a read-only type without interior mutability.
36
- // unsafe impl Sync for DynamicPublisher {}
37
-
38
30
impl DynamicPublisher {
39
31
/// Creates a new `DynamicPublisher`.
40
32
///
41
33
/// Node and namespace changes are always applied _before_ topic remapping.
42
- pub ( crate ) fn new (
43
- node_handle : Arc < NodeHandle > ,
44
- topic : & str ,
34
+ pub ( crate ) fn new < ' a > (
45
35
topic_type : MessageTypeName ,
46
- qos : QoSProfile ,
36
+ options : impl Into < PublisherOptions < ' a > > ,
37
+ node_handle : Arc < NodeHandle > ,
47
38
) -> Result < Self , RclrsError > {
48
39
// This loads the introspection type support library.
49
40
let metadata = DynamicMessageMetadata :: new ( topic_type) ?;
41
+ let PublisherOptions { topic, qos } = options. into ( ) ;
50
42
// However, we also need the regular type support library –
51
43
// the rosidl_typesupport_c one.
52
44
let message_type = & metadata. message_type ;
0 commit comments