Skip to main content

AbiCheck

Enum AbiCheck 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

§engine_version: String

The duckdb_library_version() string reported by the engine.

§slots: usize

The slot count this extension was compiled against, all of which the engine lays out identically.

§

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

§engine_version: String

The duckdb_library_version() string reported by the engine.

§engine_slots: usize

Slot count the running engine uses.

§compiled_slots: usize

Slot count this extension was compiled against.

§

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

§engine_version: String

The duckdb_library_version() string reported by the engine.

§compiled_slots: usize

Slot count this extension was compiled against.

§

EngineVersionUnavailable

duckdb_library_version() returned a null or non-UTF-8 pointer.

Fields

§compiled_slots: usize

Slot count this extension was compiled against.

§

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.

Fields

§declared_version: String

The declared QUACK_RS_TARGET_DUCKDB_VERSION.

§declared_slots: usize

Slot count that release is known to use.

§compiled_slots: usize

Slot count this extension was actually compiled against.

Implementations§

Source§

impl AbiCheck

Source

pub const fn is_compatible(&self) -> bool

Returns true if it is safe to call into the unstable API region.

Source

pub fn error_message(&self) -> Option<String>

Returns a diagnostic message suitable for access.set_error, or None when the check passed.

Trait Implementations§

Source§

impl Clone for AbiCheck

Source§

fn clone(&self) -> AbiCheck

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiCheck

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AbiCheck

Source§

impl PartialEq for AbiCheck

Source§

fn eq(&self, other: &AbiCheck) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AbiCheck

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.