[−][src]Struct guard_trait::AssertSafe
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]
T: Deref,
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]
T: Deref<Target = U>,
U: ?Sized,
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
fn borrow_guarded(&self) -> &Self::Target
[src]
impl<T, U> GuardedMut for AssertSafe<T> where
T: Deref<Target = U> + DerefMut,
U: ?Sized,
[src]
T: Deref<Target = U> + DerefMut,
U: ?Sized,
fn borrow_guarded_mut(&mut self) -> &mut Self::Target
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for AssertSafe<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for AssertSafe<T> where
T: Send,
T: Send,
impl<T> Sync for AssertSafe<T> where
T: Sync,
T: Sync,
impl<T> Unpin for AssertSafe<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for AssertSafe<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Guarded for T where
T: Deref<Target = U> + StableDeref + 'static,
U: ?Sized,
[src]
T: Deref<Target = U> + StableDeref + 'static,
U: ?Sized,
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
pub fn borrow_guarded(&Self) -> &U
[src]
impl<T, U> GuardedMut for T where
T: DerefMut<Target = U> + StableDeref + 'static,
U: ?Sized,
[src]
T: DerefMut<Target = U> + StableDeref + 'static,
U: ?Sized,
pub fn borrow_guarded_mut(&mut Self) -> &mut U
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,