pub struct MockProcessBuilder { /* private fields */ }Expand description
Builder for creating mock RunResult instances.
This provides a fluent API for constructing RunResult values
with sensible defaults for testing.
§Defaults
wall_ms: 0exit_code: 0timed_out: falsecpu_ms: Nonepage_faults: Nonectx_switches: Nonemax_rss_kb: Nonebinary_bytes: Nonestdout: emptystderr: empty
§Example
use perfgate_fake::MockProcessBuilder;
let result = MockProcessBuilder::new()
.exit_code(0)
.wall_ms(100)
.stdout(b"hello world\n".to_vec())
.cpu_ms(50)
.max_rss_kb(2048)
.build();
assert_eq!(result.exit_code, 0);
assert_eq!(result.wall_ms, 100);
assert_eq!(result.stdout, b"hello world\n");
assert_eq!(result.cpu_ms, Some(50));
assert_eq!(result.max_rss_kb, Some(2048));Implementations§
Source§impl MockProcessBuilder
impl MockProcessBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with default values.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn success() -> Self
pub fn success() -> Self
Create a builder pre-configured for a successful result.
Equivalent to new().exit_code(0).
Sourcepub fn failure() -> Self
pub fn failure() -> Self
Create a builder pre-configured for a failed result.
Equivalent to new().exit_code(1).
Sourcepub fn timeout() -> Self
pub fn timeout() -> Self
Create a builder pre-configured for a timed-out result.
Equivalent to new().exit_code(-1).timed_out(true).
Sourcepub fn wall_ms(self, ms: u64) -> Self
pub fn wall_ms(self, ms: u64) -> Self
Set the wall clock time in milliseconds.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn exit_code(self, code: i32) -> Self
pub fn exit_code(self, code: i32) -> Self
Set the process exit code.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn cpu_ms(self, ms: u64) -> Self
pub fn cpu_ms(self, ms: u64) -> Self
Set the CPU time in milliseconds.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn page_faults(self, faults: u64) -> Self
pub fn page_faults(self, faults: u64) -> Self
Set the number of major page faults.
Sourcepub fn ctx_switches(self, switches: u64) -> Self
pub fn ctx_switches(self, switches: u64) -> Self
Set the number of context switches.
Sourcepub fn max_rss_kb(self, kb: u64) -> Self
pub fn max_rss_kb(self, kb: u64) -> Self
Set the peak RSS in kilobytes.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn binary_bytes(self, bytes: u64) -> Self
pub fn binary_bytes(self, bytes: u64) -> Self
Set the binary size in bytes.
Sourcepub fn stdout(self, output: Vec<u8>) -> Self
pub fn stdout(self, output: Vec<u8>) -> Self
Set the stdout content.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn stdout_str(self, output: &str) -> Self
pub fn stdout_str(self, output: &str) -> Self
Set the stdout content from a string.
Sourcepub fn stderr(self, output: Vec<u8>) -> Self
pub fn stderr(self, output: Vec<u8>) -> Self
Set the stderr content.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Sourcepub fn stderr_str(self, output: &str) -> Self
pub fn stderr_str(self, output: &str) -> Self
Set the stderr content from a string.
Sourcepub fn build(self) -> RunResult
pub fn build(self) -> RunResult
Build the final RunResult.
Examples found in repository?
8fn main() {
9 println!("=== perfgate-fake Basic Example ===\n");
10
11 println!("1. Creating a fake process runner:");
12 let runner = FakeProcessRunner::new();
13 println!(" Created empty FakeProcessRunner");
14
15 println!("\n2. Configuring mock results with MockProcessBuilder:");
16 let success_result = MockProcessBuilder::new()
17 .exit_code(0)
18 .wall_ms(100)
19 .stdout(b"hello world".to_vec())
20 .stderr(b"".to_vec())
21 .build();
22
23 runner.set_result(&["echo", "hello"], success_result);
24 println!(" Configured: echo hello -> exit 0, 100ms, stdout='hello world'");
25
26 let slow_result = MockProcessBuilder::new()
27 .exit_code(0)
28 .wall_ms(500)
29 .stdout(b"slow output".to_vec())
30 .build();
31
32 runner.set_result(&["slow", "command"], slow_result);
33 println!(" Configured: slow command -> exit 0, 500ms");
34
35 let failure_result = MockProcessBuilder::new()
36 .exit_code(1)
37 .wall_ms(50)
38 .stderr(b"error: something went wrong".to_vec())
39 .build();
40
41 runner.set_result(&["failing", "cmd"], failure_result);
42 println!(" Configured: failing cmd -> exit 1, 50ms");
43
44 println!("\n3. Running commands with the fake runner:");
45 let spec1 = CommandSpec {
46 name: "echo-hello".to_string(),
47 argv: vec!["echo".to_string(), "hello".to_string()],
48 cwd: None,
49 env: vec![],
50 timeout: None,
51 output_cap_bytes: 1024,
52 };
53
54 match runner.run(&spec1) {
55 Ok(result) => {
56 println!(" echo hello:");
57 println!(" Exit code: {}", result.exit_code);
58 println!(" Wall time: {} ms", result.wall_ms);
59 println!(" Stdout: {:?}", String::from_utf8_lossy(&result.stdout));
60 }
61 Err(e) => println!(" Error: {}", e),
62 }
63
64 let spec2 = CommandSpec {
65 name: "failing-cmd".to_string(),
66 argv: vec!["failing".to_string(), "cmd".to_string()],
67 cwd: None,
68 env: vec![],
69 timeout: None,
70 output_cap_bytes: 1024,
71 };
72
73 match runner.run(&spec2) {
74 Ok(result) => {
75 println!(" failing cmd:");
76 println!(" Exit code: {}", result.exit_code);
77 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
78 }
79 Err(e) => println!(" Error: {}", e),
80 }
81
82 println!("\n4. Testing deterministic behavior:");
83 let spec3 = CommandSpec {
84 name: "slow-command".to_string(),
85 argv: vec!["slow".to_string(), "command".to_string()],
86 cwd: None,
87 env: vec![],
88 timeout: None,
89 output_cap_bytes: 1024,
90 };
91
92 let r1 = runner.run(&spec3).unwrap();
93 let r2 = runner.run(&spec3).unwrap();
94 println!(" First run: {} ms", r1.wall_ms);
95 println!(" Second run: {} ms", r2.wall_ms);
96 println!(" Same result: {}", r1.wall_ms == r2.wall_ms);
97
98 println!("\n5. Default behavior for unconfigured commands:");
99 let unknown_spec = CommandSpec {
100 name: "unknown-command".to_string(),
101 argv: vec!["unknown".to_string(), "command".to_string()],
102 cwd: None,
103 env: vec![],
104 timeout: None,
105 output_cap_bytes: 1024,
106 };
107
108 match runner.run(&unknown_spec) {
109 Ok(result) => {
110 println!(" Unknown command returned default:");
111 println!(" Exit code: {}", result.exit_code);
112 println!(" Wall time: {} ms", result.wall_ms);
113 }
114 Err(e) => println!(" Error: {}", e),
115 }
116
117 println!("\n6. Setting fallback result for all unconfigured commands:");
118 let fallback_result = MockProcessBuilder::new()
119 .exit_code(127)
120 .wall_ms(1)
121 .stderr(b"command not found".to_vec())
122 .build();
123
124 runner.set_fallback(fallback_result);
125 println!(" Set fallback: exit 127, 1ms, stderr='command not found'");
126
127 let another_unknown = CommandSpec {
128 name: "another-unknown".to_string(),
129 argv: vec!["another".to_string(), "unknown".to_string()],
130 cwd: None,
131 env: vec![],
132 timeout: None,
133 output_cap_bytes: 1024,
134 };
135
136 match runner.run(&another_unknown) {
137 Ok(result) => {
138 println!(" Another unknown:");
139 println!(" Exit code: {}", result.exit_code);
140 println!(" Stderr: {:?}", String::from_utf8_lossy(&result.stderr));
141 }
142 Err(e) => println!(" Error: {}", e),
143 }
144
145 println!("\n7. Configuring with CPU and memory metrics:");
146 let detailed_result = MockProcessBuilder::new()
147 .exit_code(0)
148 .wall_ms(250)
149 .cpu_ms(200)
150 .max_rss_kb(4096)
151 .stdout(b"detailed output".to_vec())
152 .build();
153
154 runner.set_result(&["detailed"], detailed_result);
155
156 let detailed_spec = CommandSpec {
157 name: "detailed".to_string(),
158 argv: vec!["detailed".to_string()],
159 cwd: None,
160 env: vec![],
161 timeout: None,
162 output_cap_bytes: 1024,
163 };
164
165 if let Ok(result) = runner.run(&detailed_spec) {
166 println!(" Detailed result:");
167 println!(" Wall time: {} ms", result.wall_ms);
168 println!(" CPU time: {:?} ms", result.cpu_ms);
169 println!(" Max RSS: {:?} KB", result.max_rss_kb);
170 }
171
172 println!("\n=== Example complete ===");
173}Trait Implementations§
Source§impl Clone for MockProcessBuilder
impl Clone for MockProcessBuilder
Source§fn clone(&self) -> MockProcessBuilder
fn clone(&self) -> MockProcessBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MockProcessBuilder
impl Debug for MockProcessBuilder
Source§impl Default for MockProcessBuilder
impl Default for MockProcessBuilder
Source§fn default() -> MockProcessBuilder
fn default() -> MockProcessBuilder
Auto Trait Implementations§
impl Freeze for MockProcessBuilder
impl RefUnwindSafe for MockProcessBuilder
impl Send for MockProcessBuilder
impl Sync for MockProcessBuilder
impl Unpin for MockProcessBuilder
impl UnsafeUnpin for MockProcessBuilder
impl UnwindSafe for MockProcessBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more