pub struct View<T, G = SomeDefault>where
G: Gen<T>,{ /* private fields */ }Expand description
Immutably borrowed resource that may be created by default.
Node functions wrap their parameters in View, ViewMut or Move.
View 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 isSomeDefault, which denotes creating the resource using its default instance. Another option isNoDefaultwhich fails to generate the resource.
use moongraph::*;
let mut graph = Graph::default();
let default_number = graph.visit(|u: View<usize>| { *u }).map_err(|e| e.to_string());
assert_eq!(Ok(0), default_number);
let no_number = graph.visit(|f: View<f32, NoDefault>| *f);
assert!(no_number.is_err());Trait Implementations§
Source§impl<T, G> Edges for View<T, G>
impl<T, G> Edges for View<T, G>
Source§impl<'a, T, G> IntoIterator for &'a View<T, G>
impl<'a, T, G> IntoIterator for &'a View<T, G>
Source§impl<'a, S, G> IntoParallelIterator for &'a View<S, G>
impl<'a, S, G> IntoParallelIterator for &'a View<S, G>
Source§type Iter = <&'a S as IntoParallelIterator>::Iter
type Iter = <&'a S as IntoParallelIterator>::Iter
The parallel iterator type that will be created.
Source§type Item = <&'a S as IntoParallelIterator>::Item
type Item = <&'a S as IntoParallelIterator>::Item
The type of item that the parallel iterator will produce.
Source§fn into_par_iter(self) -> <&'a View<S, G> as IntoParallelIterator>::Iter
fn into_par_iter(self) -> <&'a View<S, G> as IntoParallelIterator>::Iter
Converts
self into a parallel iterator. Read moreAuto Trait Implementations§
impl<T, G> Freeze for View<T, G>
impl<T, G = SomeDefault> !RefUnwindSafe for View<T, G>
impl<T, G> Send for View<T, G>
impl<T, G> Sync for View<T, G>
impl<T, G> Unpin for View<T, G>
impl<T, G = SomeDefault> !UnwindSafe for View<T, G>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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