Loanable

Trait Loanable 

Source
pub unsafe trait Loanable<'t>: Deref { }
Expand description

The trait for types that can be used with Loaned::loan and LoanedMut::loan.

§Safety

This type must ensure that the reference returned by Deref (and DerefMut, if implemented) is valid for 't, as long as self is not used for the remainder of 't (though it may be moved).

In particular, this can’t be implemented for types like Cow, as it may return a reference to data within self (which would be invalidated when self is moved).

This is closely related to whether the type can unconditionally implement Unpin (i.e. even when Self::Target: !Unpin).

Implementations on Foreign Types§

Source§

impl<'t> Loanable<'t> for String

Source§

impl<'t, 'a: 't, T: ?Sized> Loanable<'t> for &'a T

Source§

impl<'t, 'a: 't, T: ?Sized> Loanable<'t> for &'a mut T

Source§

impl<'t, T> Loanable<'t> for Vec<T>

Source§

impl<'t, T: ?Sized> Loanable<'t> for Box<T>

Source§

impl<'t, T: ?Sized> Loanable<'t> for Rc<T>

Source§

impl<'t, T: ?Sized> Loanable<'t> for Arc<T>

Implementors§