pub fn map<U: ?Sized, F>(this: Self, f: F) -> Mut<U>
    where
        F: FnOnce(&mut T) -> &mut U,
    {
        let Self {
            mut data,
            guard,
            inner,
            ..
        } = this;

        // Safety: this follows the same safety guarantees as when the managed
        // ref was acquired. And since we have a managed reference to `T`, we're
        // permitted to do any sort of projection to `U`.
        let data = f(unsafe { data.as_mut() });

        Mut {
            data: data.into(),
            guard,
            inner,
        }
    }
/// Map the interior reference of an owned mutable value.
///
/// # Examples
///
/// ```rust
/// use runestick::{Mut, Shared};
///
/// # fn main() -> runestick::Result<()> {
/// let vec = Shared::<Vec<u32>>::new(vec![1, 2, 3, 4]);
/// let vec = vec.into_mut()?;
/// let value: Mut<[u32]> = Mut::map(vec, |vec| &mut vec[0..2]);
///
/// assert_eq!(&*value, &mut [1u32, 2u32][..]);
/// # Ok(()) }
/// ```
Map the interior reference of an owned mutable value.
Map the interior reference of an owned mutable value .
pub fn map<U: ?Sized, F>(this: Self, f: F) -> Mut<U>
    where
        F: FnOnce(&mut T) -> &mut U,
    {
        let Self {
            mut data,
            guard,
            inner,
            ..
        } = this;
        // Safety: this follows the same safety guarantees as when the managed
        // ref was acquired. And since we have a managed reference to `T`, we're
        // permitted to do any sort of projection to `U`.
        let data = f(unsafe { data.as_mut() });
        Mut {
            data: data.into(),
            guard,
            inner,
        }
    }
pub fn map < U : ? Sized , F > ( this : Self , f : F ) -> Mut < U > where F : FnOnce ( & mut T ) -> & mut U , { let Self { mut data , guard , inner , .. } = this ; // Safety: this follows the same safety guarantees as when the managed // ref was acquired. And since we have a managed reference to `T`, we're // permitted to do any sort of projection to `U`. let data = f ( unsafe { data . as_mut ( ) } ) ; Mut { data : data . into ( ) , guard , inner , } }
Map the interior reference of an owned mutable value.
Map the interior reference of an owned mutable value .
this
Self
f
F
this
Self
f
F
examples
```rust
use runestick::{Mut, Shared}.
` ` ` rust use runestick :: { Mut Shared } .
fn main() -> runestick::result<()> {
None
ok(()) }
None