1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! # `Method::Auto` — hardware-aware automatic selection
//!
//! `Method::Auto` is the default. It probes the drive type and IO
//! primitive availability once at handle construction and picks the
//! fastest method that is safe on the current hardware and OS.
//!
//! Resolution ladder (abridged — full matrix in `Method::Auto`'s
//! rustdoc):
//!
//! | Condition | Resolves to |
//! |-------------------------------------|-------------|
//! | Linux + io_uring + NVMe | `Direct` |
//! | Linux + NVMe without io_uring | `Data` |
//! | Linux + SSD | `Data` |
//! | Linux + HDD or unknown | `Sync` |
//! | macOS + NVMe | `Direct` |
//! | macOS + non-NVMe SSD or unknown | `Sync` |
//! | Windows + NVMe | `Direct` |
//! | Windows + SSD | `Direct` |
//! | Windows + HDD or unknown | `Sync` |
//! | Hardware probe failed entirely | `Sync` (universal safety) |
//!
//! `Auto` is the right pick unless you have a specific reason to
//! override. Even on `Auto`, the resolved method is observable.
//!
//! Run: `cargo run --example 07_method_auto`
use builder;