Struct opool::RefGuard

source ·
pub struct RefGuard<'a, P: PoolAllocator<T>, T> { /* private fields */ }
Expand description

A struct representing a guard over an object in the pool.

This struct ensures that the object is returned to the pool when it is dropped.

Implementations§

source§

impl<'a, P: PoolAllocator<T>, T> RefGuard<'a, P, T>

source

pub fn into_inner(self) -> T

Consumes the guard and returns the object, without returning it to the pool.

This method should be used with caution, as it leads to objects not being returned to the pool.

Trait Implementations§

source§

impl<'a, P: PoolAllocator<T>, T> AsRef<T> for RefGuard<'a, P, T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a, P: PoolAllocator<T>, T> Borrow<T> for RefGuard<'a, P, T>

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<'a, P: PoolAllocator<T>, T: Debug> Debug for RefGuard<'a, P, T>

source§

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

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

impl<'a, P: PoolAllocator<T>, T> Deref for RefGuard<'a, P, T>

§

type Target = T

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl<'a, P: PoolAllocator<T>, T> DerefMut for RefGuard<'a, P, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, P: PoolAllocator<T>, T: Display> Display for RefGuard<'a, P, T>

source§

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

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

impl<'a, P: PoolAllocator<T>, T> Drop for RefGuard<'a, P, T>

Implementation of the Drop trait for Guard.

This ensures that the object is returned to the pool when the guard is dropped, unless the object fails validation.

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, P: PoolAllocator<T>, T: Hash> Hash for RefGuard<'a, P, T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, P: PoolAllocator<T>, T: Ord> Ord for RefGuard<'a, P, T>

source§

fn cmp(&self, other: &RefGuard<'a, P, T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<'a, P: PoolAllocator<T>, T: PartialEq> PartialEq<RefGuard<'a, P, T>> for RefGuard<'a, P, T>

source§

fn eq(&self, other: &RefGuard<'a, P, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, P: PoolAllocator<T>, T: PartialOrd> PartialOrd<RefGuard<'a, P, T>> for RefGuard<'a, P, T>

source§

fn partial_cmp(&self, other: &RefGuard<'a, P, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &RefGuard<'a, P, T>) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &RefGuard<'a, P, T>) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

fn gt(&self, other: &RefGuard<'a, P, T>) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

fn ge(&self, other: &RefGuard<'a, P, T>) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, P: PoolAllocator<T>, T> Pointer for RefGuard<'a, P, T>

source§

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

Formats the value using the given formatter.
source§

impl<'a, P: PoolAllocator<T>, T: Eq> Eq for RefGuard<'a, P, T>

Auto Trait Implementations§

§

impl<'a, P, T> !RefUnwindSafe for RefGuard<'a, P, T>

§

impl<'a, P, T> Send for RefGuard<'a, P, T>where P: Sync, T: Send,

§

impl<'a, P, T> Sync for RefGuard<'a, P, T>where P: Sync, T: Send + Sync,

§

impl<'a, P, T> Unpin for RefGuard<'a, P, T>where T: Unpin,

§

impl<'a, P, T> !UnwindSafe for RefGuard<'a, P, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.