Struct runestick::Mut[][src]

pub struct Mut<T: ?Sized> { /* fields omitted */ }

A strong mutable reference to the given type.

Implementations

impl<T: ?Sized> Mut<T>[src]

pub fn map<U: ?Sized, F>(this: Self, f: F) -> Mut<U>

Notable traits for Mut<F>

impl<F> Future for Mut<F> where
    F: Unpin + Future
type Output = F::Output;
where
    F: FnOnce(&mut T) -> &mut U, 
[src]

Map the interior reference of an owned mutable value.

Examples

use runestick::{Mut, Shared};

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][..]);

pub fn try_map<U: ?Sized, F>(this: Self, f: F) -> Option<Mut<U>> where
    F: FnOnce(&mut T) -> Option<&mut U>, 
[src]

Try to map the mutable reference to a projection.

Examples

use runestick::{Mut, Shared};

let vec = Shared::<Vec<u32>>::new(vec![1, 2, 3, 4]);
let vec = vec.into_mut()?;
let mut value: Option<Mut<[u32]>> = Mut::try_map(vec, |vec| vec.get_mut(0..2));

assert_eq!(value.as_deref_mut(), Some(&mut [1u32, 2u32][..]));

pub fn into_raw(this: Self) -> (*mut T, RawMut)[src]

Convert into a raw pointer and associated raw access guard.

Safety

The returned pointer must not outlive the associated guard, since this prevents other uses of the underlying data which is incompatible with the current.

Trait Implementations

impl<T: ?Sized> Debug for Mut<T> where
    T: Debug
[src]

impl<T: ?Sized> Deref for Mut<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized> DerefMut for Mut<T>[src]

impl<T> FromValue for Mut<T> where
    T: Any
[src]

impl FromValue for Mut<String>[src]

impl FromValue for Mut<Object>[src]

impl FromValue for Mut<Range>[src]

impl FromValue for Mut<Tuple>[src]

impl FromValue for Mut<Vec>[src]

impl<F> Future for Mut<F> where
    F: Unpin + Future
[src]

type Output = F::Output

The type of value produced on completion.

impl<T: ?Sized> TypeOf for Mut<T> where
    T: TypeOf
[src]

Blanket implementation for owned mutable references.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Mut<T>

impl<T> !Send for Mut<T>

impl<T> !Sync for Mut<T>

impl<T: ?Sized> Unpin for Mut<T>

impl<T> !UnwindSafe for Mut<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.