MCPcopy Index your code
hub / github.com/ciphermodelabs/ciphercore / new

Method new

ciphercore-base/src/optimizer/duplicates_optimizer.rs:15–35  ·  view source on GitHub ↗
(node: Node, dep_ids: Vec<u64>)

Source from the content-addressed store, hash-verified

13
14impl NodeKey {
15 pub fn new(node: Node, dep_ids: Vec<u64>) -> Result<Option<Self>> {
16 let op = node.get_operation();
17 if op.is_prf_operation() || op.is_randomizing()? || op.is_input() {
18 // Don't try to de-duplicate PRF, randomizing and input operations.
19 return Ok(None);
20 }
21 match op {
22 Operation::Constant(_, _) => {
23 // Don't try to de-duplicate constant.
24 Ok(None)
25 }
26 Operation::Custom(_) => Err(runtime_error!(
27 "Graph has to be fully inlined for the duplicates optimization"
28 )),
29 _ => Ok(Some(NodeKey {
30 deps: dep_ids,
31 annotations: node.get_annotations()?,
32 op: node.get_operation(),
33 })),
34 }
35 }
36}
37
38fn hash_some_operations<H: Hasher>(op: &Operation, state: &mut H) {

Callers

nothing calls this directly

Calls 5

is_prf_operationMethod · 0.80
is_randomizingMethod · 0.80
is_inputMethod · 0.80
get_annotationsMethod · 0.80
get_operationMethod · 0.45

Tested by

no test coverage detected