[−][src]Trait stable_borrow::StableBorrow
A marker trait which indicates that borrows are address-stable.
A type T:
Borrow<U>
is StableBorrow<U>
if, for all instances of the
type, x.borrow() as *const U
remains valid to dereference if x
is moved
or immutably borrowed. This is true for most of the standard smart-pointer
types, but can be broken by types which borrow from their interior.
Additionally, if the type implements BorrowMut<U>
, x.borrow_mut() as &U
must be substitutable for x.borrow()
.
Safety
This trait is unsafe
to implement because unsafe code is permitted to rely
on the guarantee made by this trait.
Implementations on Foreign Types
impl<T: ?Sized> StableBorrow<T> for &T
[src]
impl<T: ?Sized> StableBorrow<T> for &mut T
[src]
impl StableBorrow<str> for String
[src]
impl<'a, T: ToOwned + ?Sized> StableBorrow<T> for Cow<'a, T> where
T::Owned: StableBorrow<T>,
[src]
T::Owned: StableBorrow<T>,