pub trait DatabaseSpec: Sized {
const VERSION: u32;
const DB_NAME: &'static str;
const SNAPSHOT_HASH: Option<u64> = None;
const EMBEDDED_SCHEMAS: &'static [EmbeddedSchema] = _;
const SNAPSHOT_FILE_SEEN: bool = true;
// Required methods
fn schema() -> SchemaDef;
fn from_database(db: Database) -> Self;
}Expand description
#[database] 생성물이 구현하는 스펙 trait —
core 빌더가 타입드 DB를 돌려줄 수 있게 한다
Required Associated Constants§
Provided Associated Constants§
Sourceconst SNAPSHOT_HASH: Option<u64> = None
const SNAPSHOT_HASH: Option<u64> = None
컴파일 타임에 읽은 현재 버전 스냅샷 파일 해시 — 파일 부재 시 None (명세 §7.4b)
Sourceconst EMBEDDED_SCHEMAS: &'static [EmbeddedSchema] = _
const EMBEDDED_SCHEMAS: &'static [EmbeddedSchema] = _
Embedded snapshots in ascending version order (spec §8.4,
decision 21c). Filled in by the #[database] macro; empty when no
snapshot files exist.
Sourceconst SNAPSHOT_FILE_SEEN: bool = true
const SNAPSHOT_FILE_SEEN: bool = true
Whether the current-version snapshot file existed when the
#[database] macro expanded (decision 28, D-3b). Defaults to true
so manual DatabaseSpec impls are unaffected. When false, the
export test keeps failing even after the file exists and matches,
until a rebuild re-expands the macro and embeds the snapshot —
closing the fail-open window where SNAPSHOT_HASH and the embedded
chain silently stay stale.
Required Methods§
Sourcefn from_database(db: Database) -> Self
fn from_database(db: Database) -> Self
core Database를 감싸 사용자 DB 타입 생성
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".