188 if (m_backpressure_strategy.has_value()) {
189 iox2_port_factory_publisher_builder_backpressure_strategy(
190 &m_handle,
static_cast<iox2_backpressure_strategy_e
>(bb::into<int>(m_backpressure_strategy.value())));
192 if (m_max_slice_len.has_value()) {
193 iox2_port_factory_publisher_builder_set_initial_max_slice_len(&m_handle, m_max_slice_len.value());
195 iox2_port_factory_publisher_builder_set_initial_max_slice_len(&m_handle, 1);
197 if (m_max_loaned_samples.has_value()) {
198 iox2_port_factory_publisher_builder_set_max_loaned_samples(&m_handle, m_max_loaned_samples.value());
200 if (m_allocation_strategy.has_value()) {
201 iox2_port_factory_publisher_builder_set_allocation_strategy(
202 &m_handle, bb::into<iox2_allocation_strategy_e>(m_allocation_strategy.value()));
205 if (m_degradation_handler.has_value()) {
206 iox2_port_factory_publisher_builder_set_degradation_handler(
210 if (m_backpressure_handler.has_value()) {
211 iox2_port_factory_publisher_builder_set_backpressure_handler(
215 if (m_override_preallocation_callback.has_value()) {
220 iox2_port_factory_publisher_builder_override_samples_preallocation(
224 if (m_name.has_value()) {
225 const auto* name_ptr = m_name.value().as_view().native_ptr();
226 iox2_port_factory_publisher_builder_set_name(&m_handle, name_ptr);
229 iox2_publisher_h pub_handle {};
231 auto result = iox2_port_factory_publisher_builder_create(m_handle,
nullptr, &pub_handle);
233 if (result == IOX2_OK) {
237 return bb::err(bb::into<PublisherCreateError>(result));
auto create() &&-> bb::Expected< Publisher< S, Payload, UserHeader >, PublisherCreateError >
Creates a new [Publisher] or returns a [PublisherCreateError] on failure.