Struct RundownRef

Source
pub struct RundownRef { /* private fields */ }
Expand description

Tracks the status of run-down protection for an object. The type would be embedded in the object needing run-down protection.

Implementations§

Source§

impl RundownRef

Source

pub fn new() -> Self

Initializes a new RundownRef.

Source

pub fn re_init(&self)

Re-initialize this instance so it can be used again. It is only valid to call re_init once the object is completely run-down, via the wait_for_rundown method.

§Important

The moment this method returns, new rundown protection requests can succeed. You must perform all re-initialization of the shared object the run-down protection is guarding before you call this method.

Source

pub fn try_acquire(&self) -> Result<RundownGuard<'_>, RundownError>

Attempts to acquire rundown protection on this RundownRef, returns the RundownGuard which holds the reference count, or returns an error if the object is already being rundown.

Source

pub fn release(&self)

Release previously acquired rundown protection.

Source

pub fn wait_for_rundown(&self)

Blocks thread execution until there are no outstanding reference counts taken on the RundownRef, and the internal representation has been marked with [RundownFlags::RUNDOWN_IN_PROGRESS] to signal that no other thread can safely acquire a reference count afterwards.

§Important
  • This method is not thread safe, it must only be called by one thread.

  • This method is however idempotent, it can be called multiple times.

Trait Implementations§

Source§

impl Default for RundownRef

Source§

fn default() -> RundownRef

Returns the “default value” for a type. Read more

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> 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.