pub struct CffiPublisher { /* private fields */ }Expand description
Publisher backed by a C vtable.
Implementations§
Source§impl CffiPublisher
impl CffiPublisher
Sourcepub fn topic_name(&self) -> &str
pub fn topic_name(&self) -> &str
Topic name. Result is the null-terminated string written at publisher creation; never re-resolved from the backend.
Sourcepub fn qos(&self) -> NrosRmwQos
pub fn qos(&self) -> NrosRmwQos
QoS used to create this publisher.
Sourcepub fn can_loan_messages(&self) -> bool
pub fn can_loan_messages(&self) -> bool
true iff the backend exposes the publish loan primitive
(Phase 99). Mirrors upstream rmw_publisher_t::can_loan_messages.
Trait Implementations§
Source§impl Drop for CffiPublisher
impl Drop for CffiPublisher
Source§impl Publisher for CffiPublisher
impl Publisher for CffiPublisher
Source§fn actual_qos(&self) -> QoSProfile
fn actual_qos(&self) -> QoSProfile
The profile the backend GRANTED, read back at create time.
Answers off the retained value rather than re-entering the backend:
upstream’s rmw_publisher_get_actual_qos is a property of the entity,
and a backend call here would make an accessor a transport operation on
a &self that any callback may hold.
Source§fn get_gid(&self) -> Result<[u8; 24], TransportError>
fn get_gid(&self) -> Result<[u8; 24], TransportError>
Upstream rmw_get_gid_for_publisher, through the vtable slot.
The phase-467 RMW gap-closure design study’s Q1, step 2. A NULL slot
answers Unsupported — uORB and XRCE NULL it. The Rust adapter table
zenoh rides FILLS it now (it was NULL there too until this study, so a
Rust backend with a real identity could not report one). Never an
all-zero gid: that is what the uninitialised rmw_gid_t below holds,
so returning it on the NULL path would make “no identity” read exactly
like an answer.
The backend’s implementation_identifier is deliberately DROPPED
here. nros_rmw_cffi_register_named admits several backends in one
image and gids from two of them are not comparable, so upstream’s
pairing matters — but the trait answers bytes, and the identifier a
caller needs is the one on the SESSION it asked. Carrying a second
copy per publisher would be a second place for it to disagree.
Source§fn count_matched_subscriptions(&self) -> Result<usize, TransportError>
fn count_matched_subscriptions(&self) -> Result<usize, TransportError>
Upstream rmw_publisher_count_matched_subscriptions, through the
vtable slot. Issue 1643 — the slot’s first RUNTIME reader (the node
API’s get_subscription_count); until then only an interop probe and
the backend’s own tests asked. A NULL slot answers Unsupported.
Source§type Error = TransportError
type Error = TransportError
Source§fn publish_raw(&self, data: &[u8]) -> Result<(), TransportError>
fn publish_raw(&self, data: &[u8]) -> Result<(), TransportError>
Source§unsafe fn publish_streamed(
&self,
size_cb: unsafe extern "C" fn(out_total_len: *mut usize, user_ctx: *mut c_void),
chunk_cb: unsafe extern "C" fn(out_buf: *mut u8, cap: usize, out_written: *mut usize, user_ctx: *mut c_void),
user_ctx: *mut c_void,
) -> Result<(), TransportError>
unsafe fn publish_streamed( &self, size_cb: unsafe extern "C" fn(out_total_len: *mut usize, user_ctx: *mut c_void), chunk_cb: unsafe extern "C" fn(out_buf: *mut u8, cap: usize, out_written: *mut usize, user_ctx: *mut c_void), user_ctx: *mut c_void, ) -> Result<(), TransportError>
Source§fn buffer_error(&self) -> TransportError
fn buffer_error(&self) -> TransportError
Source§fn serialization_error(&self) -> TransportError
fn serialization_error(&self) -> TransportError
Source§fn unsupported_event_error(&self) -> TransportError
fn unsupported_event_error(&self) -> TransportError
serialization_error()
since most backends share an Unsupported variant; backends
override if they have a distinct Unsupported mapping.Source§unsafe fn register_event_callback(
&mut self,
kind: EventKind,
deadline_ms: u32,
cb: EventCallback,
user_ctx: *mut c_void,
) -> Result<(), TransportError>
unsafe fn register_event_callback( &mut self, kind: EventKind, deadline_ms: u32, cb: EventCallback, user_ctx: *mut c_void, ) -> Result<(), TransportError>
deadline_ms applies to
EventKind::OfferedDeadlineMissed only; ignored otherwise.
Default impl returns the backend’s “unsupported”-shaped error. Read moreSource§fn supports_event(&self, kind: EventKind) -> bool
fn supports_event(&self, kind: EventKind) -> bool
true if the backend can generate this event for
this publisher. Default returns false; backends override per
supported event kind. Read moreSource§fn assert_liveliness(&self) -> Result<(), TransportError>
fn assert_liveliness(&self) -> Result<(), TransportError>
QoSLivelinessPolicy::ManualByTopic / ManualByNode;
nothing to do for the other kinds. Read more