1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use serde::Deserialize;
const DEFAULT_BELOW_MAX_DEPTH: u32 = 15;
#[derive(Default, Deserialize)]
pub struct TangleConfigBuilder {
below_max_depth: Option<u32>,
}
impl TangleConfigBuilder {
pub fn new() -> Self {
Self::default()
}
pub fn finish(self) -> TangleConfig {
TangleConfig {
below_max_depth: self.below_max_depth.unwrap_or(DEFAULT_BELOW_MAX_DEPTH),
}
}
}
#[derive(Clone)]
pub struct TangleConfig {
below_max_depth: u32,
}
impl TangleConfig {
pub fn build() -> TangleConfigBuilder {
TangleConfigBuilder::new()
}
pub fn below_max_depth(&self) -> u32 {
self.below_max_depth
}
}