Skip to main content

EmbeddedPublisher

Struct EmbeddedPublisher 

Source
pub struct EmbeddedPublisher<M> { /* private fields */ }
Expand description

Typed publisher handle.

Two methods, both byte-oriented at the wire:

No typed loan() exists. Loan/borrow live exclusively on EmbeddedRawPublisher / RawSubscription. try_loan(len) requires the byte length up front, which CDR ser/de can only discover after encoding — the two APIs are incompatible by construction. See docs/design/0010-zero-copy-raw-api.md decision D7.

Implementations§

Source§

impl<M> EmbeddedPublisher<M>
where M: RosMessage,

Source

pub fn publish(&self, msg: &M) -> Result<(), NodeError>

Publish a message using the default buffer size.

Source

pub fn publish_with_buffer<const BUF: usize>( &self, msg: &M, ) -> Result<(), NodeError>

Publish a message with a custom buffer size.

Source

pub fn publish_raw(&self, data: &[u8]) -> Result<(), NodeError>

Publish raw CDR-encoded data (must include CDR header).

Source

pub fn publish_streamed<F>( &self, total_len: usize, writer: F, ) -> Result<(), NodeError>
where F: FnMut(&mut [u8]) -> usize,

Phase 124.E.1 — streamed publish. Use a closure-driven writer to serialise straight into the backend’s outbound buffer without a per-publisher staging copy. Saves on RAM-constrained nodes that publish multi-KB payloads.

The writer closure receives a [StreamWriter] mutable reference and uses [StreamWriter::write] / [extend] / [reserved_len] to fill the slot in chunks. The total payload length must be declared up-front via [StreamWriter::reserve_total]; the backend allocates that many bytes in its outbound buffer before any chunks land.

Backends without a native stream slot fall through to a stack-allocated staging buffer (capped at 4 KiB) + a single publish_raw — same observable result, just no zero-staging win for the big-message case.

Source

pub fn assert_liveliness(&self) -> Result<(), NodeError>

Phase 108.B — manually assert this publisher’s liveliness. Required for publishers configured with [QosLivelinessPolicy::ManualByTopic] / [QosLivelinessPolicy::ManualByNode]. No-op for AUTOMATIC / NONE kinds. Returns Err(Unsupported) if the backend doesn’t implement manual liveliness.

Source

pub fn supports_event(&self, kind: EventKind) -> bool

true if the active backend can fire the named event for this publisher.

Source

pub fn on_liveliness_lost<F>(&mut self, cb: F) -> Result<(), NodeError>
where F: FnMut(CountStatus) + Send + 'static,

Register a callback for LivelinessLost. Fires when this publisher misses its own liveliness assertion deadline.

Source

pub fn on_offered_deadline_missed<F>( &mut self, deadline: Duration, cb: F, ) -> Result<(), NodeError>
where F: FnMut(CountStatus) + Send + 'static,

Register a callback for OfferedDeadlineMissed. Fires when this publisher promised deadline and falls behind.

Trait Implementations§

Source§

impl<M> Drop for EmbeddedPublisher<M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<M> Freeze for EmbeddedPublisher<M>

§

impl<M> RefUnwindSafe for EmbeddedPublisher<M>
where M: RefUnwindSafe,

§

impl<M> !Send for EmbeddedPublisher<M>

§

impl<M> !Sync for EmbeddedPublisher<M>

§

impl<M> Unpin for EmbeddedPublisher<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for EmbeddedPublisher<M>

§

impl<M> UnwindSafe for EmbeddedPublisher<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.