[][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.

Examples

use erasable::*;

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

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

Methods

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, 
[src]

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, 
[src]

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

Trait Implementations

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

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

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

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

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

type Target = P::Target

The resulting type after dereferencing.

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

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

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

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

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

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

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

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

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

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

type Output = P::Output

The type of value produced on completion.

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

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

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

type Item = P::Item

The type of the elements being iterated over.

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

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

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

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

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

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

Auto Trait Implementations

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

Blanket Implementations

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

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

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

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>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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
[src]

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.