#[non_exhaustive]pub enum AbiCheck {
Compatible {
engine_version: String,
slots: usize,
},
StableOnly,
LayoutMismatch {
engine_version: String,
engine_slots: usize,
compiled_slots: usize,
},
UnknownEngineVersion {
engine_version: String,
compiled_slots: usize,
},
EngineVersionUnavailable {
compiled_slots: usize,
},
DeclaredVersionMismatch {
declared_version: String,
declared_slots: usize,
compiled_slots: usize,
},
}Expand description
The result of an ABI layout check.
#[non_exhaustive]: a future release may report a new outcome, so a
match outside quack-rs needs a wildcard arm. AbiCheck::is_compatible
and AbiCheck::error_message cover every outcome.
use quack_rs::abi::AbiCheck;
fn passed(check: &AbiCheck) -> bool {
match check {
AbiCheck::Compatible { .. } | AbiCheck::StableOnly => true,
AbiCheck::LayoutMismatch { .. }
| AbiCheck::UnknownEngineVersion { .. }
| AbiCheck::EngineVersionUnavailable { .. }
| AbiCheck::DeclaredVersionMismatch { .. } => false,
// error[E0004]: a wildcard arm is required
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Compatible
The running DuckDB uses the duckdb_ext_api_v1 layout this extension
was compiled against, or one that only appends to it. All calls
dispatch correctly.
Fields
StableOnly
The extension only reaches into the stable prefix, so the layout of the unstable region is irrelevant. Always portable.
LayoutMismatch
The running DuckDB uses a different layout. Calling into the
unstable region would invoke the wrong function pointers.
Fields
UnknownEngineVersion
The running DuckDB reports a version this build of quack-rs has no
verified layout for — a newer release, or a -dev build.
This is not evidence that the layout matches. DuckDB has changed the
unstable region in every minor and in some patch releases, so an unknown
version must be treated as potentially incompatible.
Fields
duckdb_library_version() returned a null or non-UTF-8 pointer.
DeclaredVersionMismatch
QUACK_RS_TARGET_DUCKDB_VERSION names a DuckDB release whose verified
slot count does not match the bindings actually compiled in.
The declaration is wrong, so nothing derived from it can be trusted —
most likely Cargo resolved a different libduckdb-sys than the build
intended.
Implementations§
Source§impl AbiCheck
impl AbiCheck
Sourcepub const fn is_compatible(&self) -> bool
pub const fn is_compatible(&self) -> bool
Returns true if it is safe to call into the unstable API region.
Sourcepub fn error_message(&self) -> Option<String>
pub fn error_message(&self) -> Option<String>
Returns a diagnostic message suitable for access.set_error, or None
when the check passed.