Skip to main content

HostCustomConstructor

Trait HostCustomConstructor 

Source
pub trait HostCustomConstructor:
    CustomConstructor
    + Send
    + Sync
    + 'static {
    type Custom: HostType;
    type Fields: HostTypeSequence;
}
Expand description

A constructor proven to occur in the declared schema for Custom.

This trait is sealed. Constructors must be selected with HostCustomConstructorAt, so safe user code cannot fabricate a runtime constructor index.

use geam_core::{
    HostCustomConstructor, HostCustomConstructorListEnd, HostCustomSchema, HostCustomType,
    HostTypeListEnd,
};

struct Schema;

impl HostCustomSchema for Schema {
    const PACKAGE: &'static str = "application";
    const MODULE: &'static str = "main";
    const NAME: &'static str = "Thing";
    const PARAMETER_COUNT: usize = 0;

    type Constructors = HostCustomConstructorListEnd;
}

type Thing = HostCustomType<Schema>;
struct Fabricated;

impl HostCustomConstructor for Fabricated {
    type Custom = Thing;
    type Fields = HostTypeListEnd;
}

Required Associated Types§

Source

type Custom: HostType

Source

type Fields: HostTypeSequence

Constructor fields after substituting Custom’s concrete type arguments.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Schema, Arguments, Index, Definition> HostCustomConstructor for HostCustomConstructorAt<HostCustomType<Schema, Arguments>, Index, Definition>
where Schema: HostCustomSchema, Arguments: HostTypeSequence, Index: Send + Sync + 'static, Definition: HostCustomConstructorDefinition, Definition::Fields: ResolveCustomFields<Arguments>, Schema::Constructors: ConstructorAt<Index, Definition>,

Source§

type Custom = HostCustomType<Schema, Arguments>

Source§

type Fields = <<Definition as HostCustomConstructorDefinition>::Fields as ResolveCustomFields<Arguments>>::Fields