pub struct MockConfig {
pub default_exit_code: i32,
pub default_stdout: String,
pub default_stderr: String,
pub fail_connect: bool,
pub fail_connect_attempts: u32,
pub fail_execute: bool,
pub fail_execute_attempts: u32,
pub execution_delay_ms: u64,
pub command_results: HashMap<String, CommandResult>,
pub fail_toolchain_install: bool,
pub no_rustup: bool,
}Expand description
Configuration for mock behavior.
Fields§
§default_exit_code: i32Default exit code for commands.
default_stdout: StringDefault stdout for commands.
default_stderr: StringDefault stderr for commands.
fail_connect: boolSimulate connection failure.
fail_connect_attempts: u32Simulate transient connection failures for N attempts (then succeed).
fail_execute: boolSimulate command failure.
fail_execute_attempts: u32Simulate transient execution failures for N attempts (then succeed).
execution_delay_ms: u64Simulated execution time in milliseconds.
command_results: HashMap<String, CommandResult>Command-specific results (command -> result).
fail_toolchain_install: boolSimulate toolchain install failure.
no_rustup: boolSimulate no rustup available.
Implementations§
Source§impl MockConfig
impl MockConfig
Sourcepub fn connection_failure() -> Self
pub fn connection_failure() -> Self
Create a config that simulates connection failure.
Sourcepub fn command_failure(exit_code: i32, stderr: &str) -> Self
pub fn command_failure(exit_code: i32, stderr: &str) -> Self
Create a config that simulates command failure.
Sourcepub fn with_command_result(self, command: &str, result: CommandResult) -> Self
pub fn with_command_result(self, command: &str, result: CommandResult) -> Self
Add a specific result for a command pattern.
Sourcepub fn with_stdout(self, stdout: &str) -> Self
pub fn with_stdout(self, stdout: &str) -> Self
Set default stdout.
Sourcepub fn toolchain_install_failure() -> Self
pub fn toolchain_install_failure() -> Self
Create a config that simulates toolchain install failure.
Trait Implementations§
Source§impl Clone for MockConfig
impl Clone for MockConfig
Source§fn clone(&self) -> MockConfig
fn clone(&self) -> MockConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockConfig
impl Debug for MockConfig
Auto Trait Implementations§
impl Freeze for MockConfig
impl RefUnwindSafe for MockConfig
impl Send for MockConfig
impl Sync for MockConfig
impl Unpin for MockConfig
impl UnsafeUnpin for MockConfig
impl UnwindSafe for MockConfig
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
Mutably borrows from an owned value. Read more