ViewMut

Struct ViewMut 

Source
pub struct ViewMut<T, G = SomeDefault>
where G: Gen<T>,
{ /* private fields */ }
Expand description

A mutably borrowed resource that may be created by default.

Node functions wrap their parameters in View, ViewMut or Move.

ViewMut has two type parameters:

  • T - The type of the resource.
  • G - The method by which the resource can be generated if it doesn’t already exist. By default this is SomeDefault, which denotes creating the resource using its default implementation. Another option is NoDefault which fails to generate the resource.
use moongraph::*;

let mut graph = Graph::default();
let default_number = graph.visit(|u: ViewMut<usize>| { *u }).map_err(|e| e.to_string());
assert_eq!(Ok(0), default_number);

let no_number = graph.visit(|f: ViewMut<f32, NoDefault>| *f);
assert!(no_number.is_err());

Trait Implementations§

Source§

impl<T, G> Deref for ViewMut<T, G>
where T: Any + Send + Sync, G: Gen<T>,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<ViewMut<T, G> as Deref>::Target

Dereferences the value.
Source§

impl<T, G> DerefMut for ViewMut<T, G>
where T: Any + Send + Sync, G: Gen<T>,

Source§

fn deref_mut(&mut self) -> &mut <ViewMut<T, G> as Deref>::Target

Mutably dereferences the value.
Source§

impl<T, G> Display for ViewMut<T, G>
where T: Display + Any + Send + Sync, G: Gen<T>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, G> Edges for ViewMut<T, G>
where T: Any + Send + Sync, G: Gen<T>,

Source§

fn writes() -> Vec<TypeKey>

Keys of all write types used in fields in the implementor.
Source§

fn construct(resources: &mut TypeMap) -> Result<ViewMut<T, G>, GraphError>

Attempt to construct the implementor from the given TypeMap.
Source§

fn reads() -> Vec<TypeKey>

Keys of all read types used in fields in the implementor.
Source§

fn moves() -> Vec<TypeKey>

Keys of all move types used in fields in the implementor.
Source§

impl<'a, T, G> IntoIterator for &'a ViewMut<T, G>
where T: Send + Sync + 'static, G: Gen<T>, &'a T: IntoIterator,

Source§

type Item = <<&'a T as IntoIterator>::IntoIter as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <&'a T as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a ViewMut<T, G> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, G> IntoIterator for &'a mut ViewMut<T, G>
where T: Send + Sync + 'static, G: Gen<T>, &'a mut T: IntoIterator,

Source§

type Item = <<&'a mut T as IntoIterator>::IntoIter as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <&'a mut T as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut ViewMut<T, G> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, G> IntoParallelIterator for &'a ViewMut<T, G>
where T: Send + Sync + 'static, G: Gen<T>, &'a T: IntoParallelIterator,

Source§

type Item = <&'a T as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce.
Source§

type Iter = <&'a T as IntoParallelIterator>::Iter

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> <&'a ViewMut<T, G> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
Source§

impl<'a, T, G> IntoParallelIterator for &'a mut ViewMut<T, G>
where T: Send + Sync + 'static, G: Gen<T>, &'a mut T: IntoParallelIterator,

Source§

type Item = <&'a mut T as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce.
Source§

type Iter = <&'a mut T as IntoParallelIterator>::Iter

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> <&'a mut ViewMut<T, G> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more

Auto Trait Implementations§

§

impl<T, G> Freeze for ViewMut<T, G>

§

impl<T, G = SomeDefault> !RefUnwindSafe for ViewMut<T, G>

§

impl<T, G> Send for ViewMut<T, G>
where T: Send, G: Send,

§

impl<T, G> Sync for ViewMut<T, G>
where T: Sync, G: Sync,

§

impl<T, G> Unpin for ViewMut<T, G>
where T: Unpin, G: Unpin,

§

impl<T, G = SomeDefault> !UnwindSafe for ViewMut<T, G>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

Source§

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
Source§

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
Source§

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
Source§

impl<'data, I> IntoParallelRefMutIterator<'data> for I

Source§

type Iter = <&'data mut I as IntoParallelIterator>::Iter

The type of iterator that will be created.
Source§

type Item = <&'data mut I as IntoParallelIterator>::Item

The type of item that will be produced; this is typically an &'data mut T reference.
Source§

fn par_iter_mut( &'data mut self, ) -> <I as IntoParallelRefMutIterator<'data>>::Iter

Creates the parallel iterator from self. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> SatisfyTraits<dyn None> for T

Source§

impl<T> SatisfyTraits<dyn Send> for T
where T: Send,

Source§

impl<T> SatisfyTraits<dyn Sync + Send> for T
where T: Send + Sync,

Source§

impl<T> SatisfyTraits<dyn Sync> for T
where T: Sync,