trait CodeType: Debug {
    // Required methods
    fn type_label(&self, ci: &ComponentInterface) -> String;
    fn canonical_name(&self) -> String;

    // Provided methods
    fn literal(&self, _literal: &Literal, ci: &ComponentInterface) -> String { ... }
    fn ffi_converter_name(&self) -> String { ... }
    fn imports(&self) -> Option<Vec<String>> { ... }
    fn initialization_fn(&self) -> Option<String> { ... }
}

Required Methods§

source

fn type_label(&self, ci: &ComponentInterface) -> String

The language specific label used to reference this type. This will be used in method signatures and property declarations.

source

fn canonical_name(&self) -> String

A representation of this type label that can be used as part of another identifier. e.g. read_foo(), or FooInternals.

This is especially useful when creating specialized objects or methods to deal with this type only.

Provided Methods§

source

fn literal(&self, _literal: &Literal, ci: &ComponentInterface) -> String

source

fn ffi_converter_name(&self) -> String

Name of the FfiConverter

This is the object that contains the lower, write, lift, and read methods for this type. Depending on the binding this will either be a singleton or a class with static methods.

This is the newer way of handling these methods and replaces the lower, write, lift, and read CodeType methods. Currently only used by Kotlin, but the plan is to move other backends to using this.

source

fn imports(&self) -> Option<Vec<String>>

A list of imports that are needed if this type is in use. Classes are imported exactly once.

source

fn initialization_fn(&self) -> Option<String>

Function to run at startup

Implementors§