Skip to main content

AbiCanary

Struct AbiCanary 

Source
#[repr(C)]
pub struct AbiCanary {
Show 20 fields pub trait_object_size: usize, pub audio_buffer_size: usize, pub process_context_size: usize, pub process_status_size: usize, pub event_size: usize, pub event_body_size: usize, pub transport_size: usize, pub widget_region_size: usize, pub theme_size: usize, pub plugin_layout_size: usize, pub color_size: usize, pub vec_u8_size: usize, pub option_usize_size: usize, pub audio_buffer_align: usize, pub process_status_align: usize, pub result_normal_disc: u8, pub result_tail_disc: u8, pub result_keepalive_disc: u8, pub rustc_version_hash: u64, pub sample_precision: u8,
}
Expand description

ABI fingerprint. Compared between shell and dylib before loading.

This is the ONE #[repr(C)] type in the system - it’s the bootstrap verification struct that makes everything else safe.

Fields§

§trait_object_size: usize§audio_buffer_size: usize§process_context_size: usize§process_status_size: usize§event_size: usize§event_body_size: usize§transport_size: usize§widget_region_size: usize§theme_size: usize§plugin_layout_size: usize§color_size: usize§vec_u8_size: usize§option_usize_size: usize§audio_buffer_align: usize§process_status_align: usize§result_normal_disc: u8§result_tail_disc: u8§result_keepalive_disc: u8§rustc_version_hash: u64§sample_precision: u8

Bit-width of the plugin’s chosen sample type - 32 for f32, 64 for f64. Without this field, a shell built against prelude (f32) loading a logic dylib built against prelude64 would bind to a vtable whose process() slot expects AudioBuffer<f64> - silent UB on the first audio block. The width difference between the two AudioBuffer<S> instantiations (and dyn PluginLogic<S>) is invisible at the dyn-trait boundary, so a structural canary alone wouldn’t catch it.

Implementations§

Source§

impl AbiCanary

Source

pub fn current<S: Sample>() -> Self

Build the canary for a specific sample precision S. The shell calls this with its own S; the dylib’s truce_abi_canary export does the same with its own (from the prelude alias). The two are compared at load time.

Source

pub fn matches(&self, other: &Self) -> bool

Source

pub fn diff_report(&self, other: &Self) -> String

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> 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, 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.