RefGuard

Struct RefGuard 

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

Read guard without value lock, only structure lock (read-only access) 无值锁的读守护者,只有结构锁(只读访问)

§Safety

此结构绕过了保护值的 RwLock,仅当您确定没有其他线程正在修改该值时才应使用。 This struct bypasses the RwLock protecting the value. It should only be used when you are sure that no other thread is modifying the value.

Trait Implementations§

Source§

impl<'a, V> AsRef<V> for RefGuard<'a, V>

Source§

fn as_ref(&self) -> &V

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

impl<'a, V> Debug for RefGuard<'a, V>
where V: Debug,

Source§

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

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

impl<'a, V> Deref for RefGuard<'a, V>

Source§

type Target = V

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'a, V> Display for RefGuard<'a, V>
where V: Display,

Source§

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

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

impl<'a, V> PartialEq for RefGuard<'a, V>
where V: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, V> Eq for RefGuard<'a, V>
where V: Eq,

Auto Trait Implementations§

§

impl<'a, V> Freeze for RefGuard<'a, V>

§

impl<'a, V> RefUnwindSafe for RefGuard<'a, V>
where V: RefUnwindSafe,

§

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

§

impl<'a, V> Sync for RefGuard<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for RefGuard<'a, V>

§

impl<'a, V> UnwindSafe for RefGuard<'a, V>
where V: RefUnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.