Skip to main content

TypeContext

Enum TypeContext 

Source
pub enum TypeContext {
    Struct {
        pipeline: String,
        generator: String,
        config: Value,
    },
    Table {
        pipeline: String,
        generator: String,
        struct_config: Value,
        table_config: Value,
    },
    Enum {
        pipeline: String,
        generator: String,
        config: Value,
    },
}
Expand description

Context passed to output rule plugin functions.

This is a tagged union matching evenframe_core::typesync::plugin_types::OutputRulePluginInput. Plugins should match on the variant to dispatch: free-standing struct, table-backed struct, or tagged-union enum. Each variant carries the full evenframe-side config(s) as serde_json::Value so plugin authors don’t have to pull evenframe_core into their cdylibs. See the helper methods on TypeContext for ergonomic accessors that cover the common lookups; anything more specialized can navigate the JSON directly.

Variants§

§

Struct

A standalone (non-table) Rust struct.

Fields

§pipeline: String

Which pipeline is consuming the result: “Both”, “Typesync”, or “Schemasync”.

§generator: String

Which generator is invoking the plugin (“macroforge”, “arktype”, etc.), or empty for the schemasync pass.

§config: Value

JSON form of evenframe_core::types::StructConfig.

§

Table

A Rust struct that backs a SurrealDB table.

Fields

§pipeline: String
§generator: String
§struct_config: Value

JSON form of evenframe_core::types::StructConfig.

§table_config: Value

JSON form of evenframe_core::schemasync::table::TableConfig.

§

Enum

A tagged-union Rust enum.

Fields

§pipeline: String
§generator: String
§config: Value

JSON form of evenframe_core::types::TaggedUnion.

Implementations§

Source§

impl TypeContext

Source

pub fn pipeline(&self) -> &str

The pipeline that will consume this result (“Both”, “Typesync”, or “Schemasync”).

Source

pub fn generator(&self) -> &str

The generator invoking this plugin, or "" for the schemasync pass.

Source

pub fn type_name(&self) -> Option<&str>

The type’s PascalCase name: struct_name for structs/tables, enum_name for enums.

Source

pub fn table_name(&self) -> Option<&str>

For tables: the snake_case table name. None for non-table structs and enums.

Source

pub fn is_relation(&self) -> bool

True when the table is a relation/edge. false for non-tables.

Source

pub fn has_explicit_permissions(&self) -> bool

True when the table already has explicit permissions set (via #[permissions(...)] or the per-field #[define_field_statement(...)] aggregate). false for non-tables.

Source

pub fn has_explicit_events(&self) -> bool

True when the table already has any events defined via #[event(...)]. false for non-tables.

Source

pub fn has_explicit_mock_data(&self) -> bool

True when the table already has an explicit mock_generation_config. false for non-tables.

Source

pub fn existing_macroforge_derives(&self) -> Vec<String>

Macroforge derives already declared in the Rust source via #[macroforge_derive(...)]. Empty if none are present.

Source

pub fn annotations(&self) -> Vec<String>

Type-level #[annotation("...")] strings as written in the Rust source.

Source

pub fn raw_attributes(&self) -> BTreeMap<String, Vec<String>>

Type-level raw attribute stubs — attributes that evenframe doesn’t parse natively, keyed by attribute name with each value being the parenthesized body (or "" for bare path attributes like #[overview]). Multi-occurrence attributes preserve order.

Returned as a BTreeMap so iteration is in sorted attribute-name order, which keeps downstream annotation emission deterministic.

Source

pub fn fields(&self) -> Vec<TypeFieldInfo>

Iterate the struct’s fields (or enum’s variants). Each entry is the raw JSON node so callers can introspect anything — use the TypeFieldInfo accessors for the common fields.

Trait Implementations§

Source§

impl Debug for TypeContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeContext

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,