pub enum UserDataDir {
Temp,
TempFromTemplate(PathBuf),
Persist(PathBuf),
System,
}Expand description
User data directory configuration for browser profiles.
Controls how the browser manages user data (cookies, localStorage, settings).
The default is UserDataDir::Temp, which creates an isolated temporary
directory that is automatically cleaned up when the browser closes.
§Breaking Change
Prior to this change, browsers used the system default profile (~/.config/chromium/)
by default. To restore the old behavior, use UserDataDir::System explicitly:
use viewpoint_core::Browser;
let browser = Browser::launch()
.user_data_dir_system()
.launch()
.await?;Variants§
Temp
Create a unique temporary directory per session.
This is the default mode. Each browser instance gets its own isolated profile that is automatically deleted when the browser closes or is dropped. This prevents conflicts when running multiple browser instances concurrently.
TempFromTemplate(PathBuf)
Copy a template profile to a temporary directory.
The template directory contents are copied to a new temporary directory. The temporary directory is cleaned up when the browser closes. The original template directory is unchanged.
Use this when you need pre-configured settings, extensions, or cookies as a starting point, but still want isolation between sessions.
Persist(PathBuf)
Use a persistent directory for browser data.
Browser state (cookies, localStorage, settings) persists in the specified directory across browser restarts. The directory is NOT cleaned up when the browser closes.
Note: Using the same persistent directory for multiple concurrent browser instances will cause profile lock conflicts.
System
Use the system default profile.
On Linux, this is typically ~/.config/chromium/.
No --user-data-dir flag is passed to Chromium.
Warning: This can cause conflicts if another Chromium instance is running,
or if a previous session crashed without proper cleanup. Prefer UserDataDir::Temp
for automation scenarios.
Trait Implementations§
Source§impl Clone for UserDataDir
impl Clone for UserDataDir
Source§fn clone(&self) -> UserDataDir
fn clone(&self) -> UserDataDir
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more