MCPcopy Create free account
hub / github.com/NthTensor/Forte / tree

Method tree

benches/fork_join.rs:19–25  ·  view source on GitHub ↗

Constructs a new binary tree with the given number of layers.

(layers: usize)

Source from the content-addressed store, hash-verified

17impl Node {
18 // Constructs a new binary tree with the given number of layers.
19 pub fn tree(layers: usize) -> Self {
20 Self {
21 val: 1,
22 left: (layers != 1).then(|| Box::new(Self::tree(layers - 1))),
23 right: (layers != 1).then(|| Box::new(Self::tree(layers - 1))),
24 }
25 }
26}
27
28// Returns an iterator over the number of layers. Also returns the total number

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected