moonbitstack/moonrpc/cmd/thriftc does not have a README file

    Loader

    type Loader = (String) -> String?

    How an include is read: the path as written, resolved by the caller.

    Refused

    pub(all) suberror Refused {
    Bad(file~ : String, line~ : Int, msg~ : String)
    }

    impl Show for Refused

    Refused::output

    fn Refused::output(self : Refused, logger : &Logger) -> Unit

    Refused::to_string

    fn Refused::to_string(self : Refused) -> String

    ConstValue

    pub(all) enum ConstValue {
    CBool(Bool)
    CInt(Int64)
    CFloat(Double)
    CStr(String)
    CList(Array[ConstValue])
    CMap(Array[(ConstValue, ConstValue)])
    CEnum(String, String)
    }

    A value written in the IDL. CRecord is not a separate case from CMap: { ... } is the same syntax for a map and for a struct, and the declared type decides which of the two it is.

    Constant

    pub(all) struct Constant {
    name : String
    ty : TType
    value : ConstValue
    line : Int
    }

    DeclKind

    pub(all) enum DeclKind {
    PlainStruct
    ExceptionDecl
    UnionDecl
    }

    What a declared field list is. An exception is a struct on the wire; the difference is in a service's signature, where a throws clause names one.

    Document

    pub(all) struct Document {
    structs : Array[Struct]
    enums : Array[Enum]
    services : Array[Service]
    typedefs : Array[Typedef]
    constants : Array[Constant]
    includes : Array[String]
    }

    Emitter

    type Emitter

    Enum

    pub(all) struct Enum {
    name : String
    values : Array[(String, Int)]
    }

    Field

    pub(all) struct Field {
    id : Int
    name : String
    ty : TType
    optional : Bool
    }

    Function

    pub(all) struct Function {
    name : String
    ret : TType?
    params : Array[Param]
    exceptions : Array[Param]
    }

    Linked

    pub(all) struct Linked {
    structs : Array[Struct]
    enums : Array[Enum]
    services : Array[Service]
    by_service : Map[String, Service]
    constants : Array[Constant]
    }

    A document with its includes folded in.

    Linker

    type Linker

    Param

    pub(all) struct Param {
    id : Int
    name : String
    ty : TType
    }

    Parser

    type Parser

    Service

    pub(all) struct Service {
    name : String
    base : String?
    functions : Array[Function]
    }

    Struct

    pub(all) struct Struct {
    name : String
    fields : Array[Field]
    kind : DeclKind
    }

    TType

    pub(all) enum TType {
    Bool
    Byte
    I16
    I32
    I64
    Double
    Str
    Binary
    List(TType)
    Set(TType)
    Map(TType, TType)
    Named(String)
    }

    One Thrift value type, as the IDL spells it.

    Token

    pub(all) enum Token {
    TIdent(String)
    TStr(String)
    TNum(String)
    TFloat(Double)
    TSym(Char)
    TEof
    }

    Typedef

    pub(all) struct Typedef {
    name : String
    ty : TType
    }

    Another name for a type. It is substituted where it is used, so no alias reaches the generated code — the wire does not carry one either.
    fn link(file : String, source : String, load : (String) -> String?) -> Linked raise Refused

    Fold file's includes into it. load is what reads an included file, so the compiler itself stays free of a file system and a test can hand in a map.

    parse

    fn parse(file : String, source : String) -> Document raise Refused

    Parse one file. The includes it names are collected, not read: folding them in is link, which is where a shared.Person gets its name in the output.

    render

    fn render(file : String, source : String) -> String raise Refused

    Render one .thrift file as MoonBit. A file with no includes needs no file system.

    render_with

    fn render_with(file : String, source : String, load : (String) -> String?) -> String raise Refused

    Render one .thrift file with its includes folded in. load reads an included file; a loader that always answers None compiles a file that has no includes.