pub struct Unpinned<U, T: FromUnpinned<U>> { /* private fields */ }Expand description
A helper struct around U that remembers the T destination type.
This struct is typically used to build PinStack values using the stack_let macro
without having to specify the destination type.
§Example
use stackpin::stack_let;
// Without `Unpinned`
fn new_string(s : impl Into<String>) -> String { s.into() }
stack_let!(unmovable : Unmovable = new_string("toto"));
// With `Unpinned`
fn new_unpinned(s : impl Into<String>) -> Unpinned<String, Unmovable> { Unpinned::new(s.into()) }
stack_let!(unmovable = new_unpinned("toto"));Implementations§
Auto Trait Implementations§
impl<U, T> Freeze for Unpinned<U, T>where
U: Freeze,
impl<U, T> RefUnwindSafe for Unpinned<U, T>where
U: RefUnwindSafe,
T: RefUnwindSafe,
impl<U, T> Send for Unpinned<U, T>
impl<U, T> Sync for Unpinned<U, T>
impl<U, T> Unpin for Unpinned<U, T>
impl<U, T> UnwindSafe for Unpinned<U, T>where
U: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<U, T> FromUnpinned<Unpinned<U, T>> for Twhere
T: FromUnpinned<U>,
impl<U, T> FromUnpinned<Unpinned<U, T>> for Twhere
T: FromUnpinned<U>,
Source§type PinData = <T as FromUnpinned<U>>::PinData
type PinData = <T as FromUnpinned<U>>::PinData
This associated type can be used to retain information between the creation of the instance and its pinning.
This allows for some sort of “two-steps initialization” without having to store the initialization part in the
type itself.
Source§unsafe fn from_unpinned(
src: Unpinned<U, T>,
) -> (T, <T as FromUnpinned<Unpinned<U, T>>>::PinData)
unsafe fn from_unpinned( src: Unpinned<U, T>, ) -> (T, <T as FromUnpinned<Unpinned<U, T>>>::PinData)
Performs a first initialization step, resulting in the creation of the
Self instance. Read more