pub struct AeronImage<S: ResourceStorage<aeron_image_t> = LiveCResource<aeron_image_t>> { /* private fields */ }Implementations§
Source§impl<S: ResourceStorage<aeron_image_t>> AeronImage<S>
impl<S: ResourceStorage<aeron_image_t>> AeronImage<S>
Sourcepub fn release(&self) -> Result<i32, AeronCError>
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.
Sourcepub unsafe fn constants(
&self,
constants: &AeronImageConstants<impl ResourceStorage<aeron_image_constants_t>>,
) -> Result<i32, AeronCError>
pub unsafe fn constants( &self, constants: &AeronImageConstants<impl ResourceStorage<aeron_image_constants_t>>, ) -> Result<i32, AeronCError>
Fill in a structure with the constants in use by a image.
§Parameters
constantsstructure to fill in with the constants
§Return
0 for success and -1 for error.
§Safety
The output may contain borrowed native pointers. Do not use those pointers after the queried handle is dropped or changed. Prefer the lifetime-bound get_constants, get_buffers or get_values method.
Sourcepub fn get_constants(
&self,
) -> Result<AeronImageConstants<ScopedInline<'_, aeron_image_constants_t>>, AeronCError>
pub fn get_constants( &self, ) -> Result<AeronImageConstants<ScopedInline<'_, aeron_image_constants_t>>, AeronCError>
Fill in a structure with the constants in use by a image.
Sourcepub fn correlation_id(&self) -> Result<i64, AeronCError>
pub fn correlation_id(&self) -> Result<i64, AeronCError>
get_constants()?.correlation_id(). Call get_constants() once to read several fields
Sourcepub fn join_position(&self) -> Result<i64, AeronCError>
pub fn join_position(&self) -> Result<i64, AeronCError>
get_constants()?.join_position(). Call get_constants() once to read several fields
Sourcepub fn position_bits_to_shift(&self) -> Result<usize, AeronCError>
pub fn position_bits_to_shift(&self) -> Result<usize, AeronCError>
get_constants()?.position_bits_to_shift(). Call get_constants() once to read several fields
Sourcepub fn term_buffer_length(&self) -> Result<usize, AeronCError>
pub fn term_buffer_length(&self) -> Result<usize, AeronCError>
get_constants()?.term_buffer_length(). Call get_constants() once to read several fields
Sourcepub fn mtu_length(&self) -> Result<usize, AeronCError>
pub fn mtu_length(&self) -> Result<usize, AeronCError>
get_constants()?.mtu_length(). Call get_constants() once to read several fields
Sourcepub fn session_id(&self) -> Result<i32, AeronCError>
pub fn session_id(&self) -> Result<i32, AeronCError>
get_constants()?.session_id(). Call get_constants() once to read several fields
Sourcepub fn initial_term_id(&self) -> Result<i32, AeronCError>
pub fn initial_term_id(&self) -> Result<i32, AeronCError>
get_constants()?.initial_term_id(). Call get_constants() once to read several fields
Sourcepub fn subscriber_position_id(&self) -> Result<i32, AeronCError>
pub fn subscriber_position_id(&self) -> Result<i32, AeronCError>
get_constants()?.subscriber_position_id(). Call get_constants() once to read several fields
Sourcepub fn position(&self) -> i64
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.
Sourcepub fn is_end_of_stream(&self) -> bool
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.
Sourcepub fn end_of_stream_position(&self) -> i64
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. Or -1 for error.
Sourcepub fn active_transport_count(&self) -> Result<i32, AeronCError>
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.
Sourcepub fn is_publication_revoked(&self) -> bool
pub fn is_publication_revoked(&self) -> bool
Sourcepub fn poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>(
&self,
handler: &mut AeronFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: &mut 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
handlerto which message fragments are delivered.fragment_limitfor the number of fragments to be consumed during one polling operation.
§Return
the number of fragments that have been consumed or -1 for error.
Borrows the callback exclusively until this call returns. This method uses no callback allocation, reference count, runtime borrow check or mutex. The callback can borrow local state.
Sourcepub fn poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>)>(
&self,
handler: AeronFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>)>( &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
handlerto which message fragments are delivered.fragment_limitfor 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 variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is passed to the caller. Fragments since the poll
started (or the last COMMIT) are delivered again on the next poll
Sourcepub fn controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>(
&self,
handler: &mut AeronControlledFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, handler: &mut 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
handlerto which message fragments are delivered.fragment_limitfor the number of fragments to be consumed during one polling operation.
§Return
the number of fragments that have been consumed or -1 for error.
Borrows the callback exclusively until this call returns. This method uses no callback allocation, reference count, runtime borrow check or mutex. The callback can borrow local state.
Sourcepub fn controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>) -> aeron_controlled_fragment_handler_action_t>(
&self,
handler: AeronControlledFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>) -> 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
handlerto which message fragments are delivered.fragment_limitfor 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 variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is passed to the caller. Fragments since the poll
started (or the last COMMIT) are delivered again on the next poll
Sourcepub fn bounded_poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>(
&self,
handler: &mut AeronFragmentHandlerHandlerImpl,
limit_position: i64,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn bounded_poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: &mut 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
handlerto which message fragments are delivered.limit_positionto consume messages up to.fragment_limitfor the number of fragments to be consumed during one polling operation.
§Return
the number of fragments that have been consumed or -1 for error.
Borrows the callback exclusively until this call returns. This method uses no callback allocation, reference count, runtime borrow check or mutex. The callback can borrow local state.
Sourcepub fn bounded_poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>)>(
&self,
handler: AeronFragmentHandlerHandlerImpl,
limit_position: i64,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn bounded_poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>)>( &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
handlerto which message fragments are delivered.limit_positionto consume messages up to.fragment_limitfor 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 variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is passed to the caller. Fragments since the poll
started (or the last COMMIT) are delivered again on the next poll
Sourcepub fn bounded_controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>(
&self,
handler: &mut AeronControlledFragmentHandlerHandlerImpl,
limit_position: i64,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn bounded_controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, handler: &mut 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
handlerto which message fragments are delivered.limit_positionto consume messages up to.fragment_limitfor the number of fragments to be consumed during one polling operation.
§Return
the number of fragments that have been consumed or -1 for error.
Borrows the callback exclusively until this call returns. This method uses no callback allocation, reference count, runtime borrow check or mutex. The callback can borrow local state.
Sourcepub fn bounded_controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>) -> aeron_controlled_fragment_handler_action_t>(
&self,
handler: AeronControlledFragmentHandlerHandlerImpl,
limit_position: i64,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn bounded_controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], &AeronHeader<Borrowed<aeron_header_t>>) -> 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
handlerto which message fragments are delivered.limit_positionto consume messages up to.fragment_limitfor 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 variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is passed to the caller. Fragments since the poll
started (or the last COMMIT) are delivered again on the next poll
Sourcepub fn block_poll<AeronBlockHandlerHandlerImpl: AeronBlockHandlerCallback>(
&self,
handler: &mut AeronBlockHandlerHandlerImpl,
block_length_limit: usize,
) -> Result<i32, AeronCError>
pub fn block_poll<AeronBlockHandlerHandlerImpl: AeronBlockHandlerCallback>( &self, handler: &mut 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
handlerto which block is delivered.block_length_limitup to which a block may be in length.
§Return
the number of bytes that have been consumed or -1 for error.
Borrows the callback exclusively until this call returns. This method uses no callback allocation, reference count, runtime borrow check or mutex. The callback can borrow local state.
Sourcepub fn block_poll_fn<AeronBlockHandlerHandlerImpl: FnMut(&[u8], i32, i32)>(
&self,
handler: AeronBlockHandlerHandlerImpl,
block_length_limit: usize,
) -> Result<i32, AeronCError>
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
handlerto which block is delivered.block_length_limitup to which a block may be in length.
§Return
the number of bytes that have been consumed or -1 for error.
Stack-borrowed closure variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is passed to the caller. Fragments since the poll
started (or the last COMMIT) are delivered again on the next poll
pub fn is_closed(&self) -> bool
pub fn reject(&self, reason: &CStr) -> Result<i32, AeronCError>
pub fn get_inner(&self) -> *mut aeron_image_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_image_t
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.
Sourcepub unsafe fn get_inner_ref(&self) -> &aeron_image_t
pub unsafe fn get_inner_ref(&self) -> &aeron_image_t
Borrow the native struct.
§Safety
No Rust or native call may mutate the struct while this reference is alive. Shared wrappers also require coordination with other threads.
Source§impl AeronImage
impl AeronImage
Sourcepub unsafe fn from_ptr(
ptr: *mut aeron_image_t,
) -> AeronImage<Borrowed<aeron_image_t>>
pub unsafe fn from_ptr( ptr: *mut aeron_image_t, ) -> AeronImage<Borrowed<aeron_image_t>>
Borrow a native pointer without taking ownership.
§Safety
The pointer must be non-null. It and its parents must remain live for every use. Calls must follow Aeron’s threading and aliasing rules.
Trait Implementations§
Source§impl<S: Clone + ResourceStorage<aeron_image_t>> Clone for AeronImage<S>
impl<S: Clone + ResourceStorage<aeron_image_t>> Clone for AeronImage<S>
Source§fn clone(&self) -> AeronImage<S>
fn clone(&self) -> AeronImage<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more