Trait safer_ffi::headers::languages::PhantomCType
source · pub trait PhantomCType {
// Required methods
fn short_name(&self) -> String;
fn name_wrapping_var(
&self,
language: &dyn HeaderLanguage,
var_name: &str
) -> String;
fn name(&self, language: &dyn HeaderLanguage) -> String;
fn csharp_marshaler(&self) -> Option<String>;
fn size(&self) -> usize;
fn align(&self) -> usize;
}
Available on crate feature
headers
only.Expand description
T::assoc_func()
-> PhantomData::<T>.method()
conversion
so as to become dyn
-friendly (you can’t pass a heterogeneous array of
distinct T : Trait
s types to a function, but you can pass a slice of
PhantomData
-materialized dyn Trait
s).
In other words, we are projecting a compile-time type-level knowledge
of an array / struct / “table” of a type’s associated functions
into a runtime table of such, thence allowing runtime / dyn
amic
unification within a heterogeneous collection.