moonbitstack/moonrpc/examples/21-annotations does not have a README file

    Badge

    pub struct Badge {
    label : String
    }

    A dotted name nests the message in another: .greet.HelloReply.Badge.
    impl Message for Badge

    Greeter

    pub struct Greeter {
    greeting : String
    }

    A service is a struct, so it carries state; its #rpc.methods are the RPCs, named in PascalCase. name is the full name, its package before the last dot.

    Greeter::register

    fn[R :
    Registrar
    ] Greeter::register(self : Greeter, server : R) -> Unit

    GreeterClient

    pub struct GreeterClient[C] {
    channel : C
    }

    GreeterClient::add_up

    GreeterClient::count_to

    GreeterClient::new

    fn[C] GreeterClient::new(channel : C) -> GreeterClient[C]

    GreeterClient::say_hello

    HelloReply

    pub struct HelloReply {
    message : String
    calls : Int64
    scores : Array[Int]
    ratio : Double
    badges : Array[Badge]
    cached : Bool
    }

    HelloRequest

    pub struct HelloRequest {
    name : String
    tags : Array[String]
    nickname : String?
    mood : Mood
    extras : Map[String, Int64]
    }

    Fields are numbered in declaration order; number= sets one, and the count carries on from there. T? is proto3 optional, Map[K, V] is a map<K, V>.

    Mood

    pub enum Mood {
    Calm
    Glad
    Grumpy
    }

    An enum's values are numbered by its tags, or in order from 0, and named with the enum's name in front: MOOD_CALM. A number it does not know reads as its first value.
    impl Enum for Mood

    Number

    pub struct Number {
    value : Int
    }

    impl Message for Number

    Upto

    pub struct Upto {
    n : Int
    }

    impl Message for Upto