Struct LocalGuard

Source
pub struct LocalGuard<'a> { /* private fields */ }
Expand description

A guard that keeps the current thread marked as active.

Local guards are created by calling Collector::enter. Unlike OwnedGuard, a local guard is tied to the current thread and does not implement Send. This makes local guards relatively cheap to create and destroy.

Most of the functionality provided by this type is through the Guard trait.

Trait Implementations§

Source§

impl Debug for LocalGuard<'_>

Source§

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

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

impl Drop for LocalGuard<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Guard for LocalGuard<'_>

Source§

fn refresh(&mut self)

Refreshes the guard.

Source§

fn flush(&self)

Flush any retired values in the local batch.

Source§

fn collector(&self) -> &Collector

Returns the collector this guard was created from.

Source§

fn thread_id(&self) -> usize

Returns a numeric identifier for the current thread.

Source§

unsafe fn defer_retire<T>( &self, ptr: *mut T, reclaim: unsafe fn(*mut T, &Collector), )

Retires a value, running reclaim when no threads hold a reference to it.

Source§

fn protect<T>(&self, ptr: &AtomicPtr<T>, order: Ordering) -> *mut T

Protects the load of an atomic pointer. Read more
Source§

fn swap<T>(&self, ptr: &AtomicPtr<T>, value: *mut T, order: Ordering) -> *mut T

Stores a value into the pointer, returning the protected previous value. Read more
Source§

fn compare_exchange<T>( &self, ptr: &AtomicPtr<T>, current: *mut T, new: *mut T, success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T>

Stores a value into the pointer if the current value is the same as the current value, returning the protected previous value. Read more
Source§

fn compare_exchange_weak<T>( &self, ptr: &AtomicPtr<T>, current: *mut T, new: *mut T, success: Ordering, failure: Ordering, ) -> Result<*mut T, *mut T>

Stores a value into the pointer if the current value is the same as the current value, returning the protected previous value. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for LocalGuard<'a>

§

impl<'a> !RefUnwindSafe for LocalGuard<'a>

§

impl<'a> !Send for LocalGuard<'a>

§

impl<'a> !Sync for LocalGuard<'a>

§

impl<'a> Unpin for LocalGuard<'a>

§

impl<'a> !UnwindSafe for LocalGuard<'a>

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.