Expand description
This crate provides a safe way to extend the lifetime of a exclusive reference.
extend_mut
allows for safe extension of the lifetime of a exclusive reference
with a blocking closure.
extend_mut_async
is similar to extend_mut
, but it is async and requires
a linear type be safe - but Rust does not have linear types yet, so it is unsafe.
Structs§
- Extend
MutFuture - Future returned by returned by extend_mut_async.
Consult it’s documentation for more information and safety requirements.
'a
is to hold smaller borrow.'b
is to enforce that larger borrow is returned.
Traits§
- Extend
Mut - Trait designed to allow extending the lifetime of a mutable reference. It does not currently support async, contributions are welcome.
- Into
Extend MutReturn - Trait designed to allow returning both
&mut T
and(&mut T, R)
, as well as other uses.
Functions§
- extend_
mut - Extends the lifetime of a mutable reference.
f
must return the same reference that was passed to it, otherwise it will abort the process. You can still use this in async context, if you will call it on every poll, instead of on future creation (seepoll_fn
). - extend_
mut_ ⚠async - Async version of
extend_mut
. You should not drop the future returned byextend_mut_async
until it yieldsPoll::Ready
- if you do, it will abort the process. This function is not cancel-safe.