pub struct Method { /* private fields */ }Expand description
A single method within a relationship.
Its callback must be a pure, deterministic function of its input values and immutable captured constants, with no externally observable side effects. Equal inputs produce equivalent outputs or errors. There is no guarantee that the callback executes, or when or how often it executes. A self-referencing method must also be idempotent.
Implementations§
Source§impl Method
impl Method
Sourcepub fn new<F>(
inputs: Vec<CellId>,
outputs: Vec<CellId>,
input_types: Vec<TypeId>,
output_types: Vec<TypeId>,
f: F,
) -> Self
pub fn new<F>( inputs: Vec<CellId>, outputs: Vec<CellId>, input_types: Vec<TypeId>, output_types: Vec<TypeId>, f: F, ) -> Self
Creates a method from explicit TypeIds and a type-erased function.
- Precondition:
inputs.len() == input_types.len()andoutputs.len() == output_types.len(). - Precondition: The function must return exactly
outputs.len()values in the correct order. - Precondition:
fsatisfiesMethod’s purity and idempotence contract.
Sourcepub fn from_fn_1_1<A, B, F>(input: CellId, output: CellId, f: F) -> Self
pub fn from_fn_1_1<A, B, F>(input: CellId, output: CellId, f: F) -> Self
Creates a 1-input, 1-output method from a typed closure.
TypeIds for A and B are captured automatically. The method is validated
against its cell registrations when passed to crate::sheet::Sheet::add_relationship.
- Precondition:
fsatisfiesMethod’s purity and idempotence contract.
Sourcepub fn from_fn_2_1<A, B, C, F>(
inputs: [CellId; 2],
output: CellId,
f: F,
) -> Self
pub fn from_fn_2_1<A, B, C, F>( inputs: [CellId; 2], output: CellId, f: F, ) -> Self
Creates a 2-input, 1-output method from a typed closure.
inputs[0] maps to A and inputs[1] maps to B. TypeIds are captured
automatically. The method is validated when passed to
crate::sheet::Sheet::add_relationship.
- Precondition:
fsatisfiesMethod’s purity and idempotence contract.