Skip to main content

TypeEntry

Struct TypeEntry 

Source
pub struct TypeEntry<M = ()> {
    pub destination: Type,
    pub function: ItemFn,
    pub pre_stages: Vec<Stage<M>>,
    pub subs: Vec<TypeKey>,
    pub niches: Niches,
    pub metadata: M,
}
Expand description

Per-cell registry entry.

Fields§

§destination: Type

Wire/destination type — the form the value takes on the wire as chosen by the adapter (e.g. an i64 handle for a JNI adapter, or a *const T raw pointer for a C adapter). Other converters that ask “what’s the wire form of this rust type?” read this.

§function: ItemFn

Complete generated function for the wire-facing stage of the converter (signature, body, attributes, lifetimes). The adapter owns the shape. Callers compute this stage’s name via function.sig.ident.

§pre_stages: Vec<Stage<M>>

Rust-side stages that compose with Self::function to form the full chain — copied verbatim from the resolving crate::prebindgen::ConverterImpl::pre_stages. See that field’s docs for the chain-order semantics.

§subs: Vec<TypeKey>

Inner types whose function delegates to their converters. Empty for terminal converters; populated by wrapper converters. Used by the post-resolution propagation pass.

§niches: Niches

Wire bit-patterns this converter never produces / always rejects. Wrappers (Option<_>, sum-typed enums) carve from this set for their own discriminants. See Niches for the cascade model.

§metadata: M

Adapter-specific extras carried in by the crate::prebindgen::ConverterImpl that filled this slot. Emitter code reads this directly — the registry is the single source of truth for cross-language facts (C header names, JVM class names, etc.). Defaults to () for adapters that don’t need any.

Implementations§

Source§

impl<M> TypeEntry<M>

Source

pub fn from_converter(c: ConverterImpl<M>) -> Self

The resolved form of what a generator built.

The only difference is subs: a generator names its inners as types, and the table keys them.

Source

pub fn converter_ident(&self) -> &Ident

Identifier of the wire-facing converter function.

Source

pub fn wire_type(&self) -> &Type

Wire/destination type carried by this converter on success.

Source

pub fn input_stage_order(&self) -> impl Iterator<Item = (usize, &Stage<M>)>

Rust-side stages in input execution order, after the wire-facing converter has decoded the wire value.

Source

pub fn output_stage_order(&self) -> impl Iterator<Item = (usize, &Stage<M>)>

Rust-side stages in output execution order, before the wire-facing converter encodes the final wire value.

Source

pub fn dependency_keys(&self) -> &[TypeKey]

Immediate converter dependencies recorded by the adapter when this entry resolved.

Trait Implementations§

Source§

impl<M: Clone> Clone for TypeEntry<M>

Source§

fn clone(&self) -> TypeEntry<M>

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

Auto Trait Implementations§

§

impl<M = ()> !Send for TypeEntry<M>

§

impl<M = ()> !Sync for TypeEntry<M>

§

impl<M> Freeze for TypeEntry<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for TypeEntry<M>
where M: RefUnwindSafe,

§

impl<M> Unpin for TypeEntry<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for TypeEntry<M>
where M: UnsafeUnpin,

§

impl<M> UnwindSafe for TypeEntry<M>
where M: UnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.