[][src]Struct inert::Inert

#[repr(transparent)]
pub struct Inert<T: ?Sized> { /* fields omitted */ }

A wrapper for neutralized values.

If T is Neutralize, then it can be safely neutralized from an immutable reference. Almost everything implements Neutralize but RefCell<T> (and similar types).

If T is NeutralizeMut, then it can be safely neutralized from a mutable reference. Almost everything implements NeutralizeMut but Rc<RefCell<T>> and &'a RefCell<T> (and similar types).

If T is NeutralizeUnsafe, this type derefs to T::Output, with no safe way to reach out for the T value itself, which is why it is sound for Inert<T> to be Sync.

Methods

impl<T> Inert<T> where
    T: ?Sized
[src]

pub fn new(value: &T) -> &Self where
    T: Neutralize
[src]

Creates a new Inert<T> from a reference.

pub fn new_mut(value: &mut T) -> &Self where
    T: NeutralizeMut
[src]

Creates a new Inert<T> from a mutable reference.

pub unsafe fn new_unchecked(value: &T) -> &Self[src]

Unsafely creates a new Inert<T> from a reference.

Safety

The user must swear on the holy baguette that they won't do anything with the &T as long as any thread is still doing things with the &Inert<T>, either directly or through other neutralized values reached through the inner &T::Output value, lest they provoke undefined behaviour, or worse, spoil their entire wheat harvest.

pub fn get_ref(this: &Self) -> &T where
    T: Sync
[src]

Returns a reference to the inner T.

pub unsafe fn get_ref_unchecked(this: &Self) -> &T[src]

Unsafely returns a reference to the inner T.

Safety

Undefined behaviour is possible if T is not Sync.

Trait Implementations

impl<T: ?Sized> PartialOrd<Inert<T>> for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: PartialOrd
[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

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

impl<T: ?Sized> AsRef<<T as NeutralizeUnsafe>::Output> for Inert<T> where
    T: NeutralizeUnsafe
[src]

impl<T: ?Sized> PartialEq<Inert<T>> for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: PartialEq
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T> Sync for Inert<T> where
    T: ?Sized
[src]

impl<T: ?Sized> Ord for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: Ord
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: ?Sized> Eq for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: Eq
[src]

impl<T: ?Sized> Display for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: Display
[src]

impl<T: ?Sized> Debug for Inert<T> where
    T: NeutralizeUnsafe,
    T::Output: Debug
[src]

impl<T: ?Sized> Deref for Inert<T> where
    T: NeutralizeUnsafe
[src]

type Target = T::Output

The resulting type after dereferencing.

Auto Trait Implementations

impl<T> !Send for Inert<T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]