Skip to main content

Ref

Struct Ref 

Source
pub struct Ref<'a, T> { /* private fields */ }
Expand description

A wrapper around a C object that belongs to the value it came from, such as the context returned by archive.get_archive_context()

The lifetime ties it to that owner, so dropping or closing the owner while a Ref is alive does not compile. Use it through Deref like the wrapper itself

The owner is tracked with PhantomData rather than an Rc/Arc clone for performance: getters such as archive.aeron() are called on the hot path (for example in do_work), and a reference count would add an increment and decrement (atomic under multi-threaded) on every call. Ref holds only the C pointer, so the borrow checker enforces the lifetime at zero runtime cost

ref.clone() keeps the lifetime. Cloning the inner wrapper (T::clone(&*r)) does not, and that copy must not outlive the owner

Implementations§

Source§

impl<'a> Ref<'a, AeronArchiveContext>

Source

pub fn get_aeron(&self) -> Ref<'a, Aeron>

Source

pub fn aeron(&self) -> Ref<'a, Aeron>

Source§

impl<'a> Ref<'a, AeronArchiveControlResponsePoller>

Source§

impl<'a> Ref<'a, AeronArchiveCredentialsSupplier>

Source§

impl<'a> Ref<'a, AeronArchivePersistentSubscriptionContext>

Source

pub fn get_state_counter(&self) -> Ref<'a, AeronCounter>

Get the counter for tracking the current state of the persistent subscription.

§Return

the state counter. @see aeron_archive_persistent_subscription_context_set_state_counter

Source

pub fn get_join_difference_counter(&self) -> Ref<'a, AeronCounter>

Get the counter for tracking the join difference of the persistent subscription.

§Return

the join difference counter. @see aeron_archive_persistent_subscription_context_set_join_difference_counter

Source

pub fn get_live_left_counter(&self) -> Ref<'a, AeronCounter>

Get the counter for tracking the number of times the live stream has been left.

§Return

the live left counter. @see aeron_archive_persistent_subscription_context_set_live_left_counter

Source

pub fn get_live_joined_counter(&self) -> Ref<'a, AeronCounter>

Get the counter for tracking the number of times live has been joined.

§Return

the live joined counter. @see aeron_archive_persistent_subscription_context_set_live_joined_counter

Source§

impl<'a> Ref<'a, AeronArchiveProxy>

Source§

impl<'a> Ref<'a, AeronArchiveRecordingDescriptorPoller>

Source§

impl<'a> Ref<'a, AeronArchiveRecordingSubscriptionDescriptorPoller>

Source§

impl<'a> Ref<'a, AeronArchiveReplayMerge>

Source

pub fn image(&self) -> Ref<'a, AeronImage>

The image used for the replay and live stream.

§Return

the AeronImage

Source§

impl<'a> Ref<'a, AeronArchiveReplicationParams>

Source§

impl<'a> Ref<'a, AeronArchive>

Source

pub fn get_archive_context(&self) -> Ref<'a, AeronArchiveContext>

Retrieve the underlying AeronArchiveContext used to configure the provided AeronArchive.

Source

pub fn get_and_own_archive_context(&self) -> Ref<'a, AeronArchiveContext>

Retrieve the underlying AeronArchiveContext used to configure the provided AeronArchive.

Additionally, calling this function transfers ownership of the returned AeronArchiveContext to the caller. i.e. it is now the caller’s responsibility to close the context. This is useful when wrapping the C library in other, higher level languages.

Source

pub fn get_control_response_subscription(&self) -> Ref<'a, AeronSubscription>

Retrieve the underlying AeronSubscription used for reading responses from the connected Aeron Archive.

Source

pub fn get_and_own_control_response_subscription( &self, ) -> Ref<'a, AeronSubscription>

Retrieve the underlying AeronSubscription used for reading responses from the connected Aeron Archive.

Additionally, calling this function transfers ownership of the returned AeronSubscription to the caller. i.e. it is now the caller’s responsibility to close the subscription. This is useful when wrapping the C library in other, high level languages.

Source

pub fn control_response_poller( &self, ) -> Ref<'a, AeronArchiveControlResponsePoller>

Source

pub fn proxy(&self) -> Ref<'a, AeronArchiveProxy>

Source

pub fn ctx(&self) -> Ref<'a, AeronArchiveContext>

Source

pub fn archive_proxy(&self) -> Ref<'a, AeronArchiveProxy>

Source

pub fn subscription(&self) -> Ref<'a, AeronSubscription>

Source

pub fn recording_descriptor_poller( &self, ) -> Ref<'a, AeronArchiveRecordingDescriptorPoller>

Source

pub fn recording_subscription_descriptor_poller( &self, ) -> Ref<'a, AeronArchiveRecordingSubscriptionDescriptorPoller>

Source§

impl<'a> Ref<'a, AeronCnc>

Source

pub fn counters_reader(&self) -> Ref<'a, AeronCountersReader>

Gets a counters reader for this command and control file. This does not need to be closed manually, resources are tied to the instance of aeron_cnc.

§Return

pointer to a counters reader.

Source§

impl<'a> Ref<'a, AeronImageConstants>

Source§

impl<'a> Ref<'a, AeronStrToPtrHashMap>

Source

pub fn keys(&self) -> Ref<'a, AeronStrToPtrHashMapKey>

Source§

impl<'a> Ref<'a, Aeron>

Source

pub fn context(&self) -> Ref<'a, AeronContext>

Return the AeronContext that is in use by the given client.

§Return

the AeronContext for the given client or NULL for an error.

Source

pub fn counters_reader(&self) -> Ref<'a, AeronCountersReader>

Return a reference to the counters reader of the given client.

The AeronCountersReader is maintained by the client. And should not be freed.

§Return

AeronCountersReader or NULL for error.

Source§

impl<'a> Ref<'a, AeronUriParams>

Source

pub fn array(&self) -> Ref<'a, AeronUriParam>

Trait Implementations§

Source§

impl<T: Clone> Clone for Ref<'_, T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Ref<'_, T>

Source§

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

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

impl<T> Deref for Ref<'_, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Ref<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Ref<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Ref<'a, T>
where T: Send,

§

impl<'a, T> Sync for Ref<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Ref<'a, T>
where T: Unpin,

§

impl<'a, T> UnsafeUnpin for Ref<'a, T>
where T: UnsafeUnpin,

§

impl<'a, T> UnwindSafe for Ref<'a, T>
where T: 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> 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.