pub struct AeronPublication { /* private fields */ }Implementations§
Source§impl AeronPublication
impl AeronPublication
pub fn new(async_: &AeronAsyncAddPublication) -> Result<Self, AeronCError>
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn new_zeroed_on_heap() -> Self
pub fn new_zeroed_on_heap() -> Self
creates zeroed struct where the underlying c struct is on the heap
Sourcepub fn new_zeroed_on_stack() -> Self
pub fn new_zeroed_on_stack() -> Self
creates zeroed struct where the underlying c struct is on the stack (Use with care)
Sourcepub fn offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>,
) -> i64
pub fn offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>( &self, iov: &AeronIovec, iovcnt: usize, reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>, ) -> i64
Non-blocking publish by gathering buffer vectors into a message.
§Parameters
-
iovarray for the vectors -
iovcntof the number of vectors -
reserved_value_supplierto use for setting the reserved value field or NULL. -
clientdto pass to the reserved_value_supplier.
§Return
the new stream position otherwise a negative error value.
Sourcepub fn offerv_fn<AeronReservedValueSupplierHandlerImpl: FnMut(&mut [u8]) -> i64>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: AeronReservedValueSupplierHandlerImpl,
) -> i64
pub fn offerv_fn<AeronReservedValueSupplierHandlerImpl: FnMut(&mut [u8]) -> i64>( &self, iov: &AeronIovec, iovcnt: usize, reserved_value_supplier: AeronReservedValueSupplierHandlerImpl, ) -> i64
Non-blocking publish by gathering buffer vectors into a message.
§Parameters
-
iovarray for the vectors -
iovcntof the number of vectors -
reserved_value_supplierto use for setting the reserved value field or NULL. -
clientdto pass to the reserved_value_supplier.
§Return
the new stream position otherwise a negative error value.
Stack-borrowed closure (_fn variant): the FnMut closure lives on the
caller’s stack and is borrowed for this call only — the callback fires
synchronously inside the call, so nothing is heap-allocated, nothing is stored,
and the closure may borrow local state. Prefer this over the retained
Handler-based form on the hot path; only generated for callbacks the C
client does not retain (i.e. not stored for later firing).
§Panics
A panic inside the closure cannot unwind across the extern "C" callback
boundary and aborts the process (since Rust 1.81). Return early instead
of panicking in production fragment handlers.
Sourcepub fn channel_status(&self) -> i64
pub fn channel_status(&self) -> i64
Get the status of the media channel for this publication.
The status will be ERRORED (-1) if a socket exception occurs on setup and ACTIVE (1) if all is well.
§Return
1 for ACTIVE, -1 for ERRORED
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Has the publication seen an active Subscriber recently?
§Return
true if this publication has recently seen an active subscriber otherwise false.
Sourcepub fn constants(
&self,
constants: &AeronPublicationConstants,
) -> Result<i32, AeronCError>
pub fn constants( &self, constants: &AeronPublicationConstants, ) -> Result<i32, AeronCError>
Sourcepub fn get_constants(&self) -> Result<AeronPublicationConstants, AeronCError>
pub fn get_constants(&self) -> Result<AeronPublicationConstants, AeronCError>
Fill in a structure with the constants in use by a publication.
Sourcepub fn position(&self) -> i64
pub fn position(&self) -> i64
Get the current position to which the publication has advanced for this stream.
§Return
the current position to which the publication has advanced for this stream or a negative error value.
Sourcepub fn position_limit(&self) -> i64
pub fn position_limit(&self) -> i64
Get the position limit beyond which this publication will be back pressured.
This should only be used as a guide to determine when back pressure is likely to be applied.
§Return
the position limit beyond which this publication will be back pressured or a negative error value.
Sourcepub fn session_id(&self) -> i32
pub fn session_id(&self) -> i32
Sourcepub fn local_sockaddrs(
&self,
address_vec: &AeronIovec,
address_vec_len: usize,
) -> Result<i32, AeronCError>
pub fn local_sockaddrs( &self, address_vec: &AeronIovec, address_vec_len: usize, ) -> Result<i32, AeronCError>
Get all of the local socket addresses for this publication. Typically only one representing the control address.
§Parameters
-
address_vecto hold the received addresses -
address_vec_lenavailable length of the vector to hold the addresses
§Return
number of addresses found or -1 if there is an error. @see aeron_subscription_local_sockaddrs
pub fn image_location( dst: &mut [u8], aeron_dir: &CStr, correlation_id: i64, ) -> Result<i32, AeronCError>
pub fn get_inner(&self) -> *mut aeron_publication_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_publication_t
pub unsafe fn get_inner_mut(&self) -> &mut aeron_publication_t
Mutable access to the underlying C struct, minted from &self: nothing
prevents two live &mut at once, so the caller must ensure exclusive
access for the lifetime of the returned reference.
§Safety
No other reference (& or &mut) to the underlying struct may be
alive while the returned &mut is in use.
pub fn get_inner_ref(&self) -> &aeron_publication_t
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn close(self) -> Result<(), AeronCError>
pub fn close(self) -> Result<(), AeronCError>
Closes this resource in the C client immediately; all clones of this handle become closed (their pointer is nulled) and must not be used.
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn close_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback>(
self,
on_close_complete: Option<&Handler<AeronNotificationHandlerImpl>>,
) -> Result<(), AeronCError>
pub fn close_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback>( self, on_close_complete: Option<&Handler<AeronNotificationHandlerImpl>>, ) -> Result<(), AeronCError>
Like Self::close, but notifies on_close_complete when the close
finishes. The handler must outlive the notification (keep your
Handler alive until it has fired).
Source§impl AeronPublication
impl AeronPublication
pub fn async_add_destination( &self, client: &Aeron, destination: &CStr, ) -> Result<AeronAsyncDestination, AeronCError>
Sourcepub fn add_destination(
&self,
destination: &CStr,
timeout: Duration,
) -> Result<(), AeronCError>
pub fn add_destination( &self, destination: &CStr, timeout: Duration, ) -> Result<(), AeronCError>
Add destination (see AeronSubscription::add_destination); the owning
Aeron client is retrieved from the publication’s dependency graph.
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn offer_raw<H: AeronReservedValueSupplierCallback>(
&self,
buffer: &[u8],
reserved_value_supplier: Option<&Handler<H>>,
) -> i64
pub fn offer_raw<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H>>, ) -> i64
Raw, branch-free variant of Self::offer: returns the new stream position, or a
negative Aeron sentinel (see AeronOfferError::from_position).
Distinct name from the generated offer method (different signatures)
to avoid macro-hygiene name conflicts.
Sourcepub fn try_claim_raw(
&self,
length: usize,
buffer_claim: &AeronBufferClaim,
) -> i64
pub fn try_claim_raw( &self, length: usize, buffer_claim: &AeronBufferClaim, ) -> i64
Raw, branch-free variant of Self::try_claim: position or negative sentinel.
Sourcepub fn offer_with_reserved_value<H: AeronReservedValueSupplierCallback>(
&self,
buffer: &[u8],
reserved_value_supplier: Option<&Handler<H>>,
) -> Result<i64, AeronOfferError>
pub fn offer_with_reserved_value<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H>>, ) -> Result<i64, AeronOfferError>
Self::offer with a reserved-value supplier.
Sourcepub fn try_claim_owned(
&self,
length: usize,
) -> Result<AeronClaim, AeronOfferError>
pub fn try_claim_owned( &self, length: usize, ) -> Result<AeronClaim, AeronOfferError>
Zero-copy claim returning a RAII AeronClaim that is auto-aborted on
drop unless explicitly committed or aborted.
Sourcepub fn offer_parts(&self, parts: &[&[u8]]) -> Result<i64, AeronOfferError>
pub fn offer_parts(&self, parts: &[&[u8]]) -> Result<i64, AeronOfferError>
Gathering (vectored) publish: offer up to MAX_OFFER_PARTS buffers as ONE
message without concatenating them — zero allocation, zero copy on the
caller side (the driver gathers the parts directly).
This is the header+payload send: instead of building a Vec per message
(vec.extend(header); vec.extend(payload); offer(&vec)), pass the parts:
publication.offer_parts(&[&header_bytes, payload])?;The aeron_iovec_t array is built on the stack. Same typed-error semantics
as Self::offer. Returns AeronOfferError::TooManyParts if more than
MAX_OFFER_PARTS parts are passed (use Self::offerv with your own
iovec array for larger gathers).
Sourcepub fn status(&self) -> AeronStatus
pub fn status(&self) -> AeronStatus
High-level connection state derived from the publication handle.
Sourcepub fn registration_id(&self) -> Result<i64, AeronCError>
pub fn registration_id(&self) -> Result<i64, AeronCError>
Convenience accessor for the registration id (no direct C accessor exists;
backed by Self::get_constants). session_id, stream_id and channel
have cheap direct getters — prefer those; for registration_id /
max_payload_length in a hot loop, call Self::get_constants once and
reuse the returned AeronPublicationConstants.
Sourcepub fn max_payload_length(&self) -> Result<usize, AeronCError>
pub fn max_payload_length(&self) -> Result<usize, AeronCError>
Convenience accessor for the max payload length (see Self::registration_id).
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn offer(&self, buffer: &[u8]) -> Result<i64, AeronOfferError>
pub fn offer(&self, buffer: &[u8]) -> Result<i64, AeronOfferError>
Non-blocking publish of buffer, returning the new stream position.
Typed-error convenience wrapper over Self::offer_raw; see
AeronOfferError::is_retryable for retry-loop guidance.
Sourcepub fn try_claim(
&self,
length: usize,
buffer_claim: &AeronBufferClaim,
) -> Result<i64, AeronOfferError>
pub fn try_claim( &self, length: usize, buffer_claim: &AeronBufferClaim, ) -> Result<i64, AeronOfferError>
Zero-copy claim with typed errors — see Self::try_claim_owned for RAII.
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn get_archive_position(&self) -> Result<i64, AeronCError>
pub fn get_archive_position(&self) -> Result<i64, AeronCError>
Retrieves the current active live archive position using the Aeron counters. Returns an error if not found.
Sourcepub fn get_archive_position_with(
&self,
counters: &AeronCountersReader,
) -> Result<i64, AeronCError>
pub fn get_archive_position_with( &self, counters: &AeronCountersReader, ) -> Result<i64, AeronCError>
Retrieves the current active live archive position using the provided counter reader. Returns an error if not found.
Sourcepub fn is_archive_position_with(&self, length_inclusive: usize) -> bool
pub fn is_archive_position_with(&self, length_inclusive: usize) -> bool
Checks if the publication’s current position is within a specified inclusive length of the archive position.
Trait Implementations§
Source§impl Clone for AeronPublication
impl Clone for AeronPublication
Source§fn clone(&self) -> AeronPublication
fn clone(&self) -> AeronPublication
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more