[][src]Struct erasable::Thin

#[repr(transparent)]pub struct Thin<P: ErasablePtr> { /* fields omitted */ }

Wrapper struct to create thin pointer types.

This type is guaranteed to have the same repr as ErasedPtr.


use erasable::*;

let array = [0; 10];
let boxed = Box::new(array);
let thin_box: Thin<Box<_>> = boxed.into();

Note that this uses a Sized type: [i32; 10]. This library does not provide erasable ?Sized types. For that, try out slice-dst.


impl<P: ErasablePtr> Thin<P>[src]

pub fn into_inner(this: Self) -> P[src]

Extract the wrapped pointer.

pub fn with<F, T>(this: &Self, f: F) -> T where
    F: FnOnce(&P) -> T, 

Run a closure with a borrow of the real pointer.

pub fn with_mut<F, T>(this: &mut Self, f: F) -> T where
    F: FnOnce(&mut P) -> T, 

Run a closure with a mutable borrow of the real pointer.

pub fn ptr_eq<Q: ErasablePtr>(this: &Self, that: &Thin<Q>) -> bool[src]

Check two thin pointers for pointer equivalence.

Trait Implementations

impl<P: ErasablePtr, T: ?Sized> AsMut<T> for Thin<P> where
    P: AsMut<T>, 

impl<P: ErasablePtr, T: ?Sized> AsRef<T> for Thin<P> where
    P: AsRef<T>, 

impl<P: ErasablePtr> Clone for Thin<P> where
    P: Clone

impl<P: ErasablePtr> Debug for Thin<P> where
    P: Debug

impl<P: ErasablePtr> Deref for Thin<P> where
    P: Deref

type Target = P::Target

The resulting type after dereferencing.

impl<P: ErasablePtr> DerefMut for Thin<P> where
    P: DerefMut

impl<P: ErasablePtr> Display for Thin<P> where
    P: Display

impl<P: ErasablePtr> DoubleEndedIterator for Thin<P> where
    P: DoubleEndedIterator

impl<P: ErasablePtr> Drop for Thin<P>[src]

impl<P: ErasablePtr> Eq for Thin<P> where
    P: Eq

impl<P: ErasablePtr> ErasablePtr for Thin<P>[src]

impl<P: ErasablePtr> ExactSizeIterator for Thin<P> where
    P: ExactSizeIterator

impl<P: ErasablePtr> From<P> for Thin<P>[src]

impl<P: ErasablePtr, A> FromIterator<A> for Thin<P> where
    P: FromIterator<A>, 

impl<P: ErasablePtr> FusedIterator for Thin<P> where
    P: FusedIterator

impl<P: ErasablePtr> Future for Thin<P> where
    P: Future

type Output = P::Output

The type of value produced on completion.

impl<P: ErasablePtr> Hash for Thin<P> where
    P: Hash

impl<P: ErasablePtr> Hasher for Thin<P> where
    P: Hasher

impl<P: ErasablePtr> Iterator for Thin<P> where
    P: Iterator

type Item = P::Item

The type of the elements being iterated over.

impl<P: ErasablePtr> Ord for Thin<P> where
    P: Ord

impl<P: ErasablePtr> PartialEq<Thin<P>> for Thin<P> where
    P: PartialEq

impl<P: ErasablePtr> PartialOrd<Thin<P>> for Thin<P> where
    P: PartialOrd

impl<P: ErasablePtr> Pointer for Thin<P> where
    P: Pointer

impl<P: ErasablePtr> Send for Thin<P> where
    P: Send

impl<P: ErasablePtr> Sync for Thin<P> where
    P: Sync

Auto Trait Implementations

impl<P> Unpin for Thin<P> where
    P: Unpin

Blanket Implementations

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

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

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

impl<T> Erasable for T[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

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

impl<I> IntoIterator for I where
    I: Iterator

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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.