Skip to main content

AeronImage

Struct AeronImage 

Source
pub struct AeronImage { /* private fields */ }

Implementations§

Source§

impl AeronImage

Source

pub fn new_zeroed_on_heap() -> Self

creates zeroed struct where the underlying c struct is on the heap

Source

pub fn new_zeroed_on_stack() -> Self

creates zeroed struct where the underlying c struct is on the stack (Use with care)

Source

pub fn release(&self) -> Result<i32, AeronCError>

Release an image that was retained by aeron_subscription_image_by_session_id or aeron_subscription_image_at_index.

Unlike aeron_subscription_image_release, this function unconditionally decrements the reference count and is safe to call after the image has become unavailable (i.e. after it has been removed from the subscription’s image list).

§Return

0 for success and -1 for error.

Source

pub fn constants( &self, constants: &AeronImageConstants, ) -> Result<i32, AeronCError>

Fill in a structure with the constants in use by a image.

§Parameters
  • image to get the constants for.

  • constants structure to fill in with the constants

§Return

0 for success and -1 for error.

Source

pub fn get_constants(&self) -> Result<AeronImageConstants, AeronCError>

Fill in a structure with the constants in use by a image.

Source

pub fn position(&self) -> i64

The position this image has been consumed to by the subscriber.

§Return

the position this image has been consumed to by the subscriber.

Source

pub fn set_position(&self, position: i64) -> Result<i32, AeronCError>

👎Deprecated

Set the subscriber position for this image to indicate where it has been consumed to.

§Parameters
  • image to set the position of. @deprecated Will be removed in 1.53.0.
Source

pub fn is_end_of_stream(&self) -> bool

Is the current consumed position at the end of the stream?

§Return

true if at the end of the stream or false if not.

Source

pub fn end_of_stream_position(&self) -> i64

The position the stream reached when EOS was received from the publisher. The position will be INT64_MAX until the stream ends and EOS is set.

§Return

position the stream reached when EOS was received from the publisher.

Source

pub fn active_transport_count(&self) -> Result<i32, AeronCError>

Count of observed active transports within the image liveness timeout.

If the image is closed, then this is 0. This may also be 0 if no actual datagrams have arrived. IPC Images also will be 0.

§Return

count of active transports - 0 if Image is closed, no datagrams yet, or IPC. Or -1 for error.

Source

pub fn is_publication_revoked(&self) -> bool

Was the associated publication revoked?

§Return

true if the associated publication was revoked.

Source

pub fn poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronFragmentHandlerHandlerImpl>>, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified.

Use a fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

Source

pub fn poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader)>( &self, handler: AeronFragmentHandlerHandlerImpl, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified.

Use a fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

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.

Source

pub fn controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronControlledFragmentHandlerHandlerImpl>>, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified.

Use a controlled fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

Source

pub fn controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader) -> aeron_controlled_fragment_handler_action_t>( &self, handler: AeronControlledFragmentHandlerHandlerImpl, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified.

Use a controlled fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

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.

Source

pub fn bounded_poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronFragmentHandlerHandlerImpl>>, limit_position: i64, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified or the maximum position specified.

Use a fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position to consume messages up to.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

Source

pub fn bounded_poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader)>( &self, handler: AeronFragmentHandlerHandlerImpl, limit_position: i64, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified or the maximum position specified.

Use a fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position to consume messages up to.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

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.

Source

pub fn bounded_controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronControlledFragmentHandlerHandlerImpl>>, limit_position: i64, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified or the maximum position specified.

Use a controlled fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position to consume messages up to.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

Source

pub fn bounded_controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader) -> aeron_controlled_fragment_handler_action_t>( &self, handler: AeronControlledFragmentHandlerHandlerImpl, limit_position: i64, fragment_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of fragments as specified or the maximum position specified.

Use a controlled fragment assembler to assemble messages which span multiple fragments.

§Parameters
  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position to consume messages up to.

  • fragment_limit for the number of fragments to be consumed during one polling operation.

§Return

the number of fragments that have been consumed or -1 for error.

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.

Source

pub fn controlled_peek<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, initial_position: i64, handler: Option<&Handler<AeronControlledFragmentHandlerHandlerImpl>>, limit_position: i64, ) -> i64

👎Deprecated

Peek for new messages in a stream by scanning forward from an initial position. If new messages are found then they will be delivered to the handler up to a limited position.

Use a controlled fragment assembler to assemble messages which span multiple fragments. Scans must also start at the beginning of a message so that the assembler is reset.

§Parameters
  • initial_position from which to peek forward.

  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position up to which can be scanned.

§Return

the resulting position after the scan terminates which is a complete message or -1 for error. @deprecated Will be removed in 1.53.0.

Source

pub fn controlled_peek_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader) -> aeron_controlled_fragment_handler_action_t>( &self, initial_position: i64, handler: AeronControlledFragmentHandlerHandlerImpl, limit_position: i64, ) -> i64

👎Deprecated

Peek for new messages in a stream by scanning forward from an initial position. If new messages are found then they will be delivered to the handler up to a limited position.

Use a controlled fragment assembler to assemble messages which span multiple fragments. Scans must also start at the beginning of a message so that the assembler is reset.

§Parameters
  • initial_position from which to peek forward.

  • handler to which message fragments are delivered.

  • clientd to pass to the handler.

  • limit_position up to which can be scanned.

§Return

the resulting position after the scan terminates which is a complete message or -1 for error. @deprecated Will be removed in 1.53.0.

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.

Source

pub fn block_poll<AeronBlockHandlerHandlerImpl: AeronBlockHandlerCallback>( &self, handler: Option<&Handler<AeronBlockHandlerHandlerImpl>>, block_length_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of bytes.

A scan will terminate if a padding frame is encountered. If first frame in a scan is padding then a block for the padding is notified. If the padding comes after the first frame in a scan then the scan terminates at the offset the padding frame begins. Padding frames are delivered singularly in a block.

Padding frames may be for a greater range than the limit offset but only the header needs to be valid so relevant length of the frame is data header length.

§Parameters
  • handler to which block is delivered.

  • clientd to pass to the handler.

  • block_length_limit up to which a block may be in length.

§Return

the number of bytes that have been consumed or -1 for error.

Source

pub fn block_poll_fn<AeronBlockHandlerHandlerImpl: FnMut(&[u8], i32, i32)>( &self, handler: AeronBlockHandlerHandlerImpl, block_length_limit: usize, ) -> Result<i32, AeronCError>

Poll for new messages in a stream. If new messages are found beyond the last consumed position then they will be delivered to the handler up to a limited number of bytes.

A scan will terminate if a padding frame is encountered. If first frame in a scan is padding then a block for the padding is notified. If the padding comes after the first frame in a scan then the scan terminates at the offset the padding frame begins. Padding frames are delivered singularly in a block.

Padding frames may be for a greater range than the limit offset but only the header needs to be valid so relevant length of the frame is data header length.

§Parameters
  • handler to which block is delivered.

  • clientd to pass to the handler.

  • block_length_limit up to which a block may be in length.

§Return

the number of bytes that have been consumed or -1 for error.

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.

Source

pub fn is_closed(&self) -> bool

Source

pub fn reject(&self, reason: &CStr) -> Result<i32, AeronCError>

Source

pub fn get_inner(&self) -> *mut aeron_image_t

Source

pub unsafe fn get_inner_mut(&self) -> &mut aeron_image_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.

Source

pub fn get_inner_ref(&self) -> &aeron_image_t

Source§

impl AeronImage

Source

pub fn poll_instrumented<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronFragmentHandlerHandlerImpl>>, fragment_limit: usize, ) -> Result<i32, AeronCError>

Instrumented wrapper around AeronImage::poll that adds tracing spans when the instrument-ops feature is enabled.

Trait Implementations§

Source§

impl Clone for AeronImage

Source§

fn clone(&self) -> AeronImage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AeronImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for AeronImage

Source§

type Target = aeron_image_stct

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<&AeronImage> for *mut aeron_image_t

Source§

fn from(value: &AeronImage) -> Self

Converts to this type from the input type.
Source§

impl From<*const aeron_image_stct> for AeronImage

Source§

fn from(value: *const aeron_image_t) -> Self

Converts to this type from the input type.
Source§

impl From<*mut aeron_image_stct> for AeronImage

Source§

fn from(value: *mut aeron_image_t) -> Self

Converts to this type from the input type.
Source§

impl From<AeronImage> for *mut aeron_image_t

Source§

fn from(value: AeronImage) -> Self

Converts to this type from the input type.
Source§

impl From<AeronImage> for aeron_image_t

Source§

fn from(value: AeronImage) -> Self

Converts to this type from the input type.
Source§

impl From<aeron_image_stct> for AeronImage

Source§

fn from(value: aeron_image_t) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.