gleamgen/module

Types

pub opaque type Definable
pub opaque type ExternalModule
pub type Module {
  Module(
    definitions: List(ModuleDefinition),
    imports: List(import_.ImportedModule),
    external_module: option.Option(ExternalModule),
  )
}

Constructors

pub type ModuleDefinition {
  Definition(details: definition.Definition, value: Definable)
}

Constructors

pub type ReplacementConfig {
  ReplacementInline
  ReplacementUpdateDefinition(
    fn(definition.Definition) -> definition.Definition,
  )
}

Constructors

Values

pub fn eof() -> Module
pub fn from_source_map(
  module: source.SourceMapped(glance.Module),
) -> Module
pub fn render(
  module: Module,
  context: render.Context,
) -> render.Rendered
pub fn render_imported_module(
  module: import_.ImportedModule,
) -> render.Rendered
pub fn replace_function(
  function_name: String,
  module: Module,
  func: fn(option.Option(source.SourceMapped(glance.Function))) -> function.Function(
    func_type,
    ret,
  ),
  config: ReplacementConfig,
  handler: fn(Module, expression.Expression(func_type)) -> Module,
) -> Module
pub fn with_constant(
  details: definition.Definition,
  value: expression.Expression(t),
  handler: fn(expression.Expression(t)) -> Module,
) -> Module
pub fn with_custom_type1(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(repr, #(#(), a), generics),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type2(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(repr, #(#(#(), a), b), generics),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type3(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(), a), b), c),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type4(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(), a), b), c), d),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type5(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(#(), a), b), c), d), e),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
    constructor.Constructor(repr, e, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type6(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(#(#(), a), b), c), d), e), f),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
    constructor.Constructor(repr, e, generics),
    constructor.Constructor(repr, f, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type7(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(#(#(#(), a), b), c), d), e), f), g),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
    constructor.Constructor(repr, e, generics),
    constructor.Constructor(repr, f, generics),
    constructor.Constructor(repr, g, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type8(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(#(#(#(#(), a), b), c), d), e), f), g), h),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
    constructor.Constructor(repr, e, generics),
    constructor.Constructor(repr, f, generics),
    constructor.Constructor(repr, g, generics),
    constructor.Constructor(repr, h, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type9(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(
    repr,
    #(#(#(#(#(#(#(#(#(#(), a), b), c), d), e), f), g), h), i),
    generics,
  ),
  handler: fn(
    custom.CustomType(repr, generics),
    constructor.Constructor(repr, a, generics),
    constructor.Constructor(repr, b, generics),
    constructor.Constructor(repr, c, generics),
    constructor.Constructor(repr, d, generics),
    constructor.Constructor(repr, e, generics),
    constructor.Constructor(repr, f, generics),
    constructor.Constructor(repr, g, generics),
    constructor.Constructor(repr, h, generics),
    constructor.Constructor(repr, i, generics),
  ) -> Module,
) -> Module
pub fn with_custom_type_dynamic(
  details: definition.Definition,
  type_: custom.CustomTypeBuilder(repr, types.Dynamic, generics),
  handler: fn(
    custom.CustomType(repr, generics),
    List(constructor.Constructor(repr, types.Dynamic, generics)),
  ) -> Module,
) -> Module
pub fn with_dynamic_imports(
  modules: List(import_.ImportedModule),
  handler: fn(List(import_.ImportedModule)) -> Module,
) -> Module
pub fn with_function(
  details: definition.Definition,
  func: function.Function(func_type, ret),
  handler: fn(expression.Expression(func_type)) -> Module,
) -> Module
pub fn with_import(
  module: import_.ImportedModule,
  handler: fn(import_.ImportedModule) -> Module,
) -> Module
pub fn with_type_alias(
  details: definition.Definition,
  type_: types.GeneratedType(repr),
  handler: fn(types.GeneratedType(repr)) -> Module,
) -> Module
Search Document