playhard-launcher 0.1.1

Chrome launcher and profile management for the Playhard Rust browser automation stack.
Documentation
use std::{ffi::OsString, path::PathBuf, time::Duration};

/// The launch transport to request from Chrome.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum TransportMode {
    /// Start Chrome with `--remote-debugging-port=0`.
    WebSocket,
    /// Start Chrome with `--remote-debugging-pipe`.
    Pipe,
}

/// Options that control how Chrome is launched.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct LaunchOptions {
    /// Optional Chrome executable path. If omitted, `chrome-locations` is used.
    pub executable_path: Option<PathBuf>,
    /// Optional user data directory. If omitted, a temporary one is created.
    pub user_data_dir: Option<PathBuf>,
    /// Launch transport to use.
    pub transport_mode: TransportMode,
    /// Launch Chrome headless when set.
    pub headless: bool,
    /// Additional Chrome command-line arguments.
    pub args: Vec<OsString>,
    /// How long to wait for Chrome to become ready.
    pub startup_timeout: Duration,
}

impl Default for LaunchOptions {
    fn default() -> Self {
        Self {
            executable_path: None,
            user_data_dir: None,
            transport_mode: TransportMode::WebSocket,
            headless: false,
            args: Vec::new(),
            startup_timeout: Duration::from_secs(15),
        }
    }
}