[][src]Struct guard_trait::AssertSafe

#[repr(transparent)]pub struct AssertSafe<T> { /* fields omitted */ }

A type for pointers that cannot uphold the necessary guard invariants at the type level, but which can be assumed to behave properly by unsafe code.

Implementations

impl<T> AssertSafe<T> where
    T: Deref
[src]

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

Wrap a general-purpose pointer into a wrapper that implements the Guarded (and potentially GuardedMut) traits, provided that the pointer upholds this invariants anyway.

Safety

For the guard invariants to be upheld, the pointer must:

  • dereference into a stable location. This forbids types that implement Deref by borrowing data that they own without a heap-based container in between;
  • be owned. Any type that has a shorter lifetime than 'static, may have its borrow cancelled at any time, with the original borrowed data accessible again.

Trait Implementations

impl<T: Debug> Debug for AssertSafe<T>[src]

impl<T, U> Guarded for AssertSafe<T> where
    T: Deref<Target = U>,
    U: ?Sized
[src]

type Target = U

The target pointee that this pointer may dereference into. There are no real restrictions to what this type can be. However, the user must not assume that simply because a &Target reference is protected, that references indirectly derived (via Deref and other traits) would also be protected. Read more

impl<T, U> GuardedMut for AssertSafe<T> where
    T: Deref<Target = U> + DerefMut,
    U: ?Sized
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for AssertSafe<T> where
    T: RefUnwindSafe

impl<T> Send for AssertSafe<T> where
    T: Send

impl<T> Sync for AssertSafe<T> where
    T: Sync

impl<T> Unpin for AssertSafe<T> where
    T: Unpin

impl<T> UnwindSafe for AssertSafe<T> where
    T: UnwindSafe

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> From<T> for T[src]

impl<T, U> Guarded for T where
    T: Deref<Target = U> + StableDeref + 'static,
    U: ?Sized
[src]

type Target = U

The target pointee that this pointer may dereference into. There are no real restrictions to what this type can be. However, the user must not assume that simply because a &Target reference is protected, that references indirectly derived (via Deref and other traits) would also be protected. Read more

impl<T, U> GuardedMut for T where
    T: DerefMut<Target = U> + StableDeref + 'static,
    U: ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.