[][src]Trait stable_borrow::StableBorrow

pub unsafe trait StableBorrow<T: ?Sized>: Borrow<T> { }

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]

impl<T> StableBorrow<[T]> for Vec<T>[src]

impl<T: ?Sized> StableBorrow<T> for Box<T>[src]

impl<T: ?Sized> StableBorrow<T> for Rc<T>[src]

impl<T: ?Sized> StableBorrow<T> for Arc<T>[src]

impl StableBorrow<CStr> for CString[src]

impl StableBorrow<OsStr> for OsString[src]

impl StableBorrow<Path> for PathBuf[src]

Loading content...

Implementors

Loading content...