(node: Node, dep_ids: Vec<u64>)
| 13 | |
| 14 | impl 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 | |
| 38 | fn hash_some_operations<H: Hasher>(op: &Operation, state: &mut H) { |
nothing calls this directly
no test coverage detected