dtt

Function run

Source
pub fn run() -> Result<(), AppError>
Expand description

Runs the main library functionality with proper error handling.

This function initializes the library and performs basic setup operations. It checks for test mode and returns appropriate results based on the environment configuration.

§Errors

Returns AppError::SimulatedError in the following cases:

  • When the DTT_TEST_MODE environment variable is set to “1”
  • When environment variable access fails

§Examples

use dtt::prelude::*;

fn main() -> Result<(), AppError> {
    match dtt::run() {
        Ok(()) => println!("Library initialized successfully"),
        Err(e) => eprintln!("Error during initialization: {}", e),
    }
    Ok(())
}