Skip to main content

RexType

Trait RexType 

Source
pub trait RexType {
    // Required method
    fn rex_type() -> Type;

    // Provided method
    fn collect_rex_family(_out: &mut Vec<AdtDecl>) -> Result<(), TypeError> { ... }
}
Expand description

Rust-side type metadata for values that can appear at a Rex boundary.

Implement this trait for any Rust type that appears in a typed host function signature, a derived Rex ADT field, or other embedder-facing conversion point. The returned Type is the Rex type that users see in signatures and type errors.

Primitive Rust types such as integers, floats, bool, String, Vec<T>, Option<T>, and Result<T, E> already implement RexType. For Rust structs and enums that should be visible as Rex algebraic data types, prefer #[derive(rex::Rex)], which implements both RexType and RexAdt.

Required Methods§

Source

fn rex_type() -> Type

Return the Rex type corresponding to Self.

This type is used when Rex builds host function signatures, checks calls to native functions, and discovers the declarations needed for ADT registration.

Provided Methods§

Source

fn collect_rex_family(_out: &mut Vec<AdtDecl>) -> Result<(), TypeError>

Append Rex ADT declarations required by this type to out.

The default implementation is intentionally empty, which is correct for primitive and leaf types that do not introduce Rex ADT declarations. Derived ADTs override this to collect declarations for the full acyclic family reachable from Self and then append their own declaration.

Callers that register the family are responsible for ordering and validating the declarations before injection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl RexType for &str

Source§

impl RexType for bool

Source§

impl RexType for f32

Source§

impl RexType for f64

Source§

impl RexType for i8

Source§

impl RexType for i16

Source§

impl RexType for i32

Source§

impl RexType for i64

Source§

impl RexType for u8

Source§

impl RexType for u16

Source§

impl RexType for u32

Source§

impl RexType for u64

Source§

impl RexType for ()

Source§

impl RexType for String

Source§

impl RexType for DateTime<Utc>

Source§

impl RexType for Uuid

Source§

impl<A0: RexType> RexType for (A0,)

Source§

impl<A0: RexType, A1: RexType> RexType for (A0, A1)

Source§

impl<A0: RexType, A1: RexType, A2: RexType> RexType for (A0, A1, A2)

Source§

impl<A0: RexType, A1: RexType, A2: RexType, A3: RexType> RexType for (A0, A1, A2, A3)

Source§

impl<A0: RexType, A1: RexType, A2: RexType, A3: RexType, A4: RexType> RexType for (A0, A1, A2, A3, A4)

Source§

impl<A0: RexType, A1: RexType, A2: RexType, A3: RexType, A4: RexType, A5: RexType> RexType for (A0, A1, A2, A3, A4, A5)

Source§

impl<A0: RexType, A1: RexType, A2: RexType, A3: RexType, A4: RexType, A5: RexType, A6: RexType> RexType for (A0, A1, A2, A3, A4, A5, A6)

Source§

impl<A0: RexType, A1: RexType, A2: RexType, A3: RexType, A4: RexType, A5: RexType, A6: RexType, A7: RexType> RexType for (A0, A1, A2, A3, A4, A5, A6, A7)

Source§

impl<T: RexType> RexType for Option<T>

Source§

impl<T: RexType> RexType for Vec<T>

Source§

impl<T: RexType, E: RexType> RexType for Result<T, E>

Implementors§