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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! The engine seam: the crate-private trait every backend module
//! implements, plus the dispatcher [`crate::Database`] calls through — see
//! this crate's module doc (`lib.rs`)'s *Threading model* section.
//!
//! Crate-private end to end: nothing here is reachable outside
//! `frust-database`. A backend module (`sqlite`, `turso`) implements
//! [`EngineConn`] once; [`open_conn`] is the one place that picks which
//! backend module's `open` a [`crate::Engine`] value routes to.
use PathBuf;
use crate::;
/// One open connection to a SQL engine, held behind
/// [`crate::Database`]'s `Mutex<Box<dyn EngineConn>>` — one serialized
/// connection per handle (`lib.rs`'s *Threading model* doc). `Send` (not
/// `Sync`): a connection is only ever touched through that `Mutex`, never
/// shared bare across threads.
pub
/// Where an [`EngineConn`] opens against.
///
/// `Path`'s inner `PathBuf` is unread today — `sqlite.rs`'s stub `open`
/// ignores its `target` entirely (see its module doc); the sqlite-backend
/// task's real implementation is this field's first reader.
pub
/// Open a connection for `engine` against `target`, dispatching to the one
/// compiled backend module for that engine.
///
/// Exhaustive over exactly the [`Engine`] variants compiled into this
/// build: with neither `engine-sqlite` nor `engine-turso` on, [`Engine`]
/// has no values at all (each variant is itself feature-gated — see
/// `lib.rs`'s `Engine` doc), so this function can never actually be
/// called in that configuration (nothing can construct an `Engine` to
/// pass it) — the match below is still exhaustive with zero arms in that
/// case, which is why `target` is allowed to go unused there.
pub