pub struct Node<C> { /* private fields */ }
Expand description
Represents a value within the graph.
Nodes can calculate their value automatically based on other nondes.
Implementations§
Source§impl<C: Calc> Node<C>
impl<C: Calc> Node<C>
Wraps this node so that it can be used as an input to two or more dependent nodes.
Source§impl<C: Calc + Send + 'static> Node<C>
impl<C: Calc + Send + 'static> Node<C>
Sourcepub fn boxed(self) -> BoxNode<C::Value>
pub fn boxed(self) -> BoxNode<C::Value>
Wraps this node so that its Calc
type is hidden.
Boxing is needed when:
- you need to write the type of the node, but you can’t write the name of the concrete
Calc
type (for instance, it’s a func node involving a closure) - you have a choice of types for a node (for instance,
if a { a_node.boxed() } else { b_node.boxed() }
)
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip<C2: Calc, T, F: FnMut(C1::Value, C2::Value) -> T>(
self,
prec2: Node<C2>,
f: F,
) -> Node<Func2<C1, C2, T, F>>
pub fn zip<C2: Calc, T, F: FnMut(C1::Value, C2::Value) -> T>( self, prec2: Node<C2>, f: F, ) -> Node<Func2<C1, C2, T, F>>
Returns a new node whose value is calculated from this node and another node.
Sourcepub fn zip_update<C2: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value) -> bool>(
self,
prec2: Node<C2>,
initial_value: T,
f: F,
) -> Node<Update2<C1, C2, T, F>>
pub fn zip_update<C2: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value) -> bool>( self, prec2: Node<C2>, initial_value: T, f: F, ) -> Node<Update2<C1, C2, T, F>>
Returns a new node whose value is calculated from this node and another node. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip3<C2: Calc, C3: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
f: F,
) -> Node<Func3<C1, C2, C3, T, F>>
pub fn zip3<C2: Calc, C3: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, f: F, ) -> Node<Func3<C1, C2, C3, T, F>>
Returns a new node whose value is calculated from this node and 2 other nodes.
Sourcepub fn zip3_update<C2: Calc, C3: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
initial_value: T,
f: F,
) -> Node<Update3<C1, C2, C3, T, F>>
pub fn zip3_update<C2: Calc, C3: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, initial_value: T, f: F, ) -> Node<Update3<C1, C2, C3, T, F>>
Returns a new node whose value is calculated from this node and 2 other nodes. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip4<C2: Calc, C3: Calc, C4: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
f: F,
) -> Node<Func4<C1, C2, C3, C4, T, F>>
pub fn zip4<C2: Calc, C3: Calc, C4: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, f: F, ) -> Node<Func4<C1, C2, C3, C4, T, F>>
Returns a new node whose value is calculated from this node and 3 other nodes.
Sourcepub fn zip4_update<C2: Calc, C3: Calc, C4: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
initial_value: T,
f: F,
) -> Node<Update4<C1, C2, C3, C4, T, F>>
pub fn zip4_update<C2: Calc, C3: Calc, C4: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, initial_value: T, f: F, ) -> Node<Update4<C1, C2, C3, C4, T, F>>
Returns a new node whose value is calculated from this node and 3 other nodes. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip5<C2: Calc, C3: Calc, C4: Calc, C5: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
f: F,
) -> Node<Func5<C1, C2, C3, C4, C5, T, F>>
pub fn zip5<C2: Calc, C3: Calc, C4: Calc, C5: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, f: F, ) -> Node<Func5<C1, C2, C3, C4, C5, T, F>>
Returns a new node whose value is calculated from this node and 4 other nodes.
Sourcepub fn zip5_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
initial_value: T,
f: F,
) -> Node<Update5<C1, C2, C3, C4, C5, T, F>>
pub fn zip5_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, initial_value: T, f: F, ) -> Node<Update5<C1, C2, C3, C4, C5, T, F>>
Returns a new node whose value is calculated from this node and 4 other nodes. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip6<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
f: F,
) -> Node<Func6<C1, C2, C3, C4, C5, C6, T, F>>
pub fn zip6<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, f: F, ) -> Node<Func6<C1, C2, C3, C4, C5, C6, T, F>>
Returns a new node whose value is calculated from this node and 5 other nodes.
Sourcepub fn zip6_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
initial_value: T,
f: F,
) -> Node<Update6<C1, C2, C3, C4, C5, C6, T, F>>
pub fn zip6_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, initial_value: T, f: F, ) -> Node<Update6<C1, C2, C3, C4, C5, C6, T, F>>
Returns a new node whose value is calculated from this node and 5 other nodes. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip7<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
prec7: Node<C7>,
f: F,
) -> Node<Func7<C1, C2, C3, C4, C5, C6, C7, T, F>>
pub fn zip7<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, prec7: Node<C7>, f: F, ) -> Node<Func7<C1, C2, C3, C4, C5, C6, C7, T, F>>
Returns a new node whose value is calculated from this node and 6 other nodes.
Sourcepub fn zip7_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
prec7: Node<C7>,
initial_value: T,
f: F,
) -> Node<Update7<C1, C2, C3, C4, C5, C6, C7, T, F>>
pub fn zip7_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, prec7: Node<C7>, initial_value: T, f: F, ) -> Node<Update7<C1, C2, C3, C4, C5, C6, C7, T, F>>
Returns a new node whose value is calculated from this node and 6 other nodes. The FnMut
that performs the
calculation can update the value in place.
Source§impl<C1: Calc> Node<C1>
impl<C1: Calc> Node<C1>
Sourcepub fn zip8<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, C8: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value, C8::Value) -> T>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
prec7: Node<C7>,
prec8: Node<C8>,
f: F,
) -> Node<Func8<C1, C2, C3, C4, C5, C6, C7, C8, T, F>>
pub fn zip8<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, C8: Calc, T, F: FnMut(C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value, C8::Value) -> T>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, prec7: Node<C7>, prec8: Node<C8>, f: F, ) -> Node<Func8<C1, C2, C3, C4, C5, C6, C7, C8, T, F>>
Returns a new node whose value is calculated from this node and 7 other nodes.
Sourcepub fn zip8_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, C8: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value, C8::Value) -> bool>(
self,
prec2: Node<C2>,
prec3: Node<C3>,
prec4: Node<C4>,
prec5: Node<C5>,
prec6: Node<C6>,
prec7: Node<C7>,
prec8: Node<C8>,
initial_value: T,
f: F,
) -> Node<Update8<C1, C2, C3, C4, C5, C6, C7, C8, T, F>>
pub fn zip8_update<C2: Calc, C3: Calc, C4: Calc, C5: Calc, C6: Calc, C7: Calc, C8: Calc, T, F: FnMut(&mut T, C1::Value, C2::Value, C3::Value, C4::Value, C5::Value, C6::Value, C7::Value, C8::Value) -> bool>( self, prec2: Node<C2>, prec3: Node<C3>, prec4: Node<C4>, prec5: Node<C5>, prec6: Node<C6>, prec7: Node<C7>, prec8: Node<C8>, initial_value: T, f: F, ) -> Node<Update8<C1, C2, C3, C4, C5, C6, C7, C8, T, F>>
Returns a new node whose value is calculated from this node and 7 other nodes. The FnMut
that performs the
calculation can update the value in place.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Node<C>where
C: Freeze,
impl<C> !RefUnwindSafe for Node<C>
impl<C> Send for Node<C>where
C: Send,
impl<C> Sync for Node<C>where
C: Sync,
impl<C> Unpin for Node<C>where
C: Unpin,
impl<C> !UnwindSafe for Node<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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