pub struct LoadConfig {
pub sources: Vec<SourceDecl>,
pub defs: Vec<String>,
}Expand description
装载配置(store.config.json 的 sources + defs)
Fields§
§sources: Vec<SourceDecl>保持声明顺序(serde_json::Map 为 BTreeMap ⇒ 字典序;确定性输出)
defs: Vec<String>Implementations§
Source§impl LoadConfig
impl LoadConfig
Sourcepub fn from_json(v: &Value) -> Result<Self, String>
pub fn from_json(v: &Value) -> Result<Self, String>
解析 { "sources": { <name>: { kind, databases:[...] } }, "defs": [<root>...] }。
非法即 Err(禁静默兜底;含 kind 白名单、databases 非空、defs 非空)。
Sourcepub fn source_of_db(&self, db: &str) -> Result<(&SourceDecl, u8), String>
pub fn source_of_db(&self, db: &str) -> Result<(&SourceDecl, u8), String>
db 名 → (连接声明, 语义深度):同一 db 名挂多个连接 ⇒ Err(设计 §5.2)。
深度由 depth_layered 按 kind 决定(PG=2,其余=1)。
Trait Implementations§
Source§impl Clone for LoadConfig
impl Clone for LoadConfig
Source§impl Debug for LoadConfig
impl Debug for LoadConfig
Auto Trait Implementations§
impl Freeze for LoadConfig
impl RefUnwindSafe for LoadConfig
impl Send for LoadConfig
impl Sync for LoadConfig
impl Unpin for LoadConfig
impl UnsafeUnpin for LoadConfig
impl UnwindSafe for LoadConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more