Skip to content

Commit b476d0f

Browse files
committed
imp(rbspy): add RbspyConfig helper functions
1 parent 6c77888 commit b476d0f

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

pyroscope_backends/src/rbspy.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,35 @@ impl Default for RbspyConfig {
3636

3737
impl RbspyConfig {
3838
/// Create a new RbspyConfig
39-
pub fn new(
40-
pid: i32, sample_rate: u32, lock_process: bool, time_limit: Option<core::time::Duration>,
41-
with_subprocesses: bool,
42-
) -> Self {
39+
pub fn new(pid: i32) -> Self {
4340
RbspyConfig {
4441
pid: Some(pid),
42+
..Default::default()
43+
}
44+
}
45+
46+
pub fn sample_rate(self, sample_rate: u32) -> Self {
47+
RbspyConfig {
4548
sample_rate,
49+
..self
50+
}
51+
}
52+
53+
pub fn lock_process(self, lock_process: bool) -> Self {
54+
RbspyConfig {
4655
lock_process,
47-
time_limit,
56+
..self
57+
}
58+
}
59+
60+
pub fn time_limit(self, time_limit: Option<core::time::Duration>) -> Self {
61+
RbspyConfig { time_limit, ..self }
62+
}
63+
64+
pub fn with_subprocesses(self, with_subprocesses: bool) -> Self {
65+
RbspyConfig {
4866
with_subprocesses,
67+
..self
4968
}
5069
}
5170
}

0 commit comments

Comments
 (0)