moonproto

wire

moonbitstack/moonproto/wire

Tags, varints, fixed-width numbers, length-delimited values and groups.

structLimitsThe depth and byte ceiling a reader applies to one message.

The depth and byte ceiling a reader applies to one message.

pub(all) struct Limits
depth : Int32
size : Int32
enumWireType
pub(all) enum WireType
Varint
Fixed64
LengthDelimited
StartGroup
EndGroup
Fixed32
suberrorRefusedA wire-format refusal

A wire-format refusal. The offset is where the reader stopped, `got` is what it saw and `want` is what the format required.

pub(all) suberror Refused
Incomplete(Int32)
Malformed(Int32, Int32, Int32)
Overflow(Int32)
FieldNumber(Int32, Int32)
WireType(Int32, Int32)
Recursion(Int32)
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fnWireType::codeThe tag's low three bits.

The tag's low three bits.

pub fn WireType::code(Self) -> Int32
fnWireType::equal
pub fn WireType::equal(Self, Self) -> Bool
fnWireType::not_equal
pub fn WireType::not_equal(Self, Self) -> Bool
fnWireType::ofThe wire type for a tag's low three bits, or `None` when the value is not a wire type at all.

The wire type for a tag's low three bits, or `None` when the value is not a wire type at all.

pub fn WireType::of(Int32) -> Self?
fnappend_bytesAppend a length-delimited body: a varint length then the bytes.

Append a length-delimited body: a varint length then the bytes.

pub fn append_bytes(@buffer.Buffer, BytesView) -> Unit
fnappend_fixed32Append a little-endian 32-bit value.

Append a little-endian 32-bit value.

pub fn append_fixed32(@buffer.Buffer, UInt32) -> Unit
fnappend_fixed64Append a little-endian 64-bit value.

Append a little-endian 64-bit value.

pub fn append_fixed64(@buffer.Buffer, UInt64) -> Unit
fnappend_groupAppend a start tag, the body, and the matching end tag.

Append a start tag, the body, and the matching end tag.

pub fn append_group(@buffer.Buffer, Int32, BytesView) -> Unit
fnappend_stringAppend a length-delimited string.

Append a length-delimited string.

pub fn append_string(@buffer.Buffer, StringView) -> Unit
fnappend_tagAppend a tag, itself a varint of `(number << 3) | wire_type`.

Append a tag, itself a varint of `(number << 3) | wire_type`.

pub fn append_tag(@buffer.Buffer, Int32, WireType) -> Unit
fnappend_varintAppend a base-128 varint: seven bits per octet, high bit set on every octet but the last.

Append a base-128 varint: seven bits per octet, high bit set on every octet but the last.

pub fn append_varint(@buffer.Buffer, UInt64) -> Unit
fnconsume_bytesRead a length-delimited body, returning a view of it and the offset just past it.

Read a length-delimited body, returning a view of it and the offset just past it.

pub fn consume_bytes(BytesView, at? : Int32, limit? : Int32) -> (BytesView, Int32) raise Refused
fnconsume_fixed32Read a little-endian 32-bit value.

Read a little-endian 32-bit value.

pub fn consume_fixed32(BytesView, at? : Int32, limit? : Int32) -> (UInt32, Int32) raise Refused
fnconsume_fixed64Read a little-endian 64-bit value.

Read a little-endian 64-bit value.

pub fn consume_fixed64(BytesView, at? : Int32, limit? : Int32) -> (UInt64, Int32) raise Refused
fnconsume_groupRead a group body after its start tag

Read a group body after its start tag. `at` is the offset just past the start tag; the returned view excludes both tags.

pub fn consume_group(BytesView, Int32, at? : Int32, limit? : Int32, limits? : Limits) -> (BytesView, Int32) raise Refused
fnconsume_stringRead a length-delimited string, refusing invalid UTF-8 as the format requires.

Read a length-delimited string, refusing invalid UTF-8 as the format requires.

pub fn consume_string(BytesView, at? : Int32, limit? : Int32) -> (String, Int32) raise Refused
fnconsume_tagRead a tag, returning the field number, the wire type, and the offset just past it.

Read a tag, returning the field number, the wire type, and the offset just past it.

pub fn consume_tag(BytesView, at? : Int32, limit? : Int32) -> (Int32, WireType, Int32) raise Refused
fnconsume_varintRead a varint, returning the value and the offset just past it.

Read a varint, returning the value and the offset just past it.

pub fn consume_varint(BytesView, at? : Int32, limit? : Int32) -> (UInt64, Int32) raise Refused
fndecode_boolAny non-zero varint is `true`.

Any non-zero varint is `true`.

pub fn decode_bool(UInt64) -> Bool
fndecode_tagSplit a tag into its number and wire type.

Split a tag into its number and wire type.

pub fn decode_tag(UInt64) -> (Int32, WireType) raise Refused
fndecode_zigzagThe inverse of `encode_zigzag`.

The inverse of `encode_zigzag`.

pub fn decode_zigzag(UInt64) -> Int64
fnencode_bool`true` is one, `false` is zero.

`true` is one, `false` is zero.

pub fn encode_bool(Bool) -> UInt64
fnencode_tagA tag as one integer.

A tag as one integer.

pub fn encode_tag(Int32, WireType) -> UInt64
fnencode_zigzagMap a signed integer to an unsigned one that stays short for small magnitudes: `(n << 1) ^ (n…

Map a signed integer to an unsigned one that stays short for small magnitudes: `(n << 1) ^ (n >> 63)`.

pub fn encode_zigzag(Int64) -> UInt64
fnsize_bytesThe number of octets a length-delimited body occupies, prefix included.

The number of octets a length-delimited body occupies, prefix included.

pub fn size_bytes(Int32) -> Int32
fnsize_groupThe number of octets a group occupies, both tags included.

The number of octets a group occupies, both tags included.

pub fn size_group(Int32, Int32) -> Int32
fnsize_tagThe number of octets a tag occupies.

The number of octets a tag occupies.

pub fn size_tag(Int32) -> Int32
fnsize_varintThe number of octets a varint occupies.

The number of octets a varint occupies.

pub fn size_varint(UInt64) -> Int32
fnskip_fieldSkip one whole field, returning the offset just past it.

Skip one whole field, returning the offset just past it.

pub fn skip_field(BytesView, at? : Int32, limit? : Int32, limits? : Limits) -> Int32 raise Refused
letlimitsThe reference defaults: ten thousand levels, and no practical byte ceiling.

The reference defaults: ten thousand levels, and no practical byte ceiling.

pub let limits : Limits
letmax_field_numberThe largest field number the format allows.

The largest field number the format allows.

pub let max_field_number : Int32

reflect

moonbitstack/moonproto/reflect

Value, Message, the descriptor records and the global registries.

structElementHow to move one element of a repeated or map field between its typed form and a `Value`

How to move one element of a repeated or map field between its typed form and a `Value`. `copy_into` exists because a message element cannot be reconstructed from a `Value`: the concrete type is only known here, so the value is copied into storage instead.

pub(all) struct Element[T]
to_value : (T) -> Value
from_value : (Value) -> T
make : () -> T
copy_into : (T, &Message) -> Unit
is_message : Bool
structEnumDescriptor
pub(all) struct EnumDescriptor
name : String
full_name : String
values : Array[EnumValueDescriptor]
closed : Bool
file_path : String
structEnumValueDescriptor
pub(all) struct EnumValueDescriptor
name : String
number : Int32
full_name : String
structFieldDescriptor
pub(all) struct FieldDescriptor
name : String
full_name : String
number : Int32
kind : Kind
cardinality : Cardinality
json_name : String
text_name : String
has_presence : Bool
is_extension : Bool
is_map : Bool
packed : Bool
oneof_index : Int32?
message_type : String?
enum_type : String?
structFileDescriptor
pub(all) struct FileDescriptor
path : String
package_name : String
syntax : Syntax
messages : Array[MessageDescriptor]
enums : Array[EnumDescriptor]
services : Array[ServiceDescriptor]
extensions : Array[FieldDescriptor]
dependencies : Array[String]
public_dependencies : Array[String]
edition : String?
option_map : Array[(String, Array[(String, String)])]
structFilesFile descriptors, looked up by path or by a declaration's qualified name.

File descriptors, looked up by path or by a declaration's qualified name.

pub struct Files
files : Array[FileDescriptor]
structMessageDescriptor
pub(all) struct MessageDescriptor
name : String
full_name : String
syntax : Syntax
fields : Array[FieldDescriptor]
oneofs : Array[OneofDescriptor]
is_map_entry : Bool
reserved_names : Array[String]
reserved_ranges : Array[(Int32, Int32)]
required_numbers : Array[Int32]
extension_ranges : Array[(Int32, Int32)]
nested_messages : Array[MessageDescriptor]
nested_enums : Array[EnumDescriptor]
nested_extensions : Array[FieldDescriptor]
file_path : String
structMethodDescriptor
pub(all) struct MethodDescriptor
name : String
full_name : String
input_type : String
output_type : String
streaming_client : Bool
streaming_server : Bool
structOneofDescriptor
pub(all) struct OneofDescriptor
name : String
synthetic : Bool
field_numbers : Array[Int32]
structRawFieldsThe bytes of every unknown field a message carried, tag and body included.

The bytes of every unknown field a message carried, tag and body included.

pub(all) struct RawFields(Bytes)
structServiceDescriptor
pub(all) struct ServiceDescriptor
name : String
full_name : String
methods : Array[MethodDescriptor]
file_path : String
structTypedListA repeated field backed by the array the message stores.

A repeated field backed by the array the message stores.

pub struct TypedList[T]
items : Array[T]
element : Element[T]
structTypedMapA map field backed by the map the message stores.

A map field backed by the map the message stores.

pub struct TypedMap[K, V]
entries : Map[K, V]
key_value : (K) -> MapKey
key_of : (MapKey) -> K
element : Element[V]
structTypesMessage, enum and extension types, looked up by qualified name.

Message, enum and extension types, looked up by qualified name.

pub struct Types
messages : Array[(String, &MessageType)]
enums : Array[(String, &EnumType)]
extensions : Array[(String, &ExtensionType)]
extensions_by_number : Array[(String, &ExtensionType)]
structValueListA list backed by an array

A list backed by an array. It remembers the element kind so that a new element can be built without consulting the descriptor again.

pub struct ValueList
element_kind : Kind
element_message_type : String?
items : Array[Value]
structValueMapA map backed by an association array

A map backed by an association array. Protobuf maps are usually small, and a linear lookup avoids requiring the key type to be hashable here.

pub struct ValueMap
key_kind : Kind
value_kind : Kind
value_message_type : String?
entries : Array[(MapKey, Value)]
enumCardinality
pub(all) enum Cardinality
Optional
Required
Repeated
enumKind
pub(all) enum Kind
Double
Float
Int64
Uint64
Int32
Fixed64
Fixed32
Bool
String
Group
Message
Bytes
Uint32
Enum
enumMapKey
pub(all) enum MapKey
Bool(Bool)
Int32(Int32)
Int64(Int64)
Uint32(UInt32)
Uint64(UInt64)
String(String)
enumSyntax
pub(all) enum Syntax
Proto2
Proto3
Editions
enumValueOne field value

One field value. A composite value holds a reference to a list, map or message, so mutation through it is visible to the message that owns it.

pub(all) enum Value
Invalid
Bool(Bool)
Int32(Int32)
Int64(Int64)
Uint32(UInt32)
Uint64(UInt64)
Float(Float)
Double(Double)
String(String)
Bytes(Bytes)
Enum(Int32)
Message(&Message)
ListView(&ListField)
MapView(&MapField)
suberrorRefusedA registry refusal: a name already taken.

A registry refusal: a name already taken.

pub(all) suberror Refused
Conflict(String)
traitEnumA concrete enum value.

A concrete enum value.

pub(open) trait Enum
fn descriptor(Self) -> EnumDescriptor
fn enum_type(Self) -> &EnumType
fn number(Self) -> Int32
traitEnumTypeAn enum's concrete type: its descriptor and a constructor.

An enum's concrete type: its descriptor and a constructor.

pub(open) trait EnumType
fn new_enum(Self, Int32) -> &Enum
fn descriptor(Self) -> EnumDescriptor
traitExtensionTypeA concrete extension: its type and validation of a value assigned to it.

A concrete extension: its type and validation of a value assigned to it.

pub(open) trait ExtensionType
fn new_value(Self) -> Value
fn zero(Self) -> Value
fn descriptor(Self) -> FieldDescriptor
fn is_valid_value(Self, Value) -> Bool
traitFreshA message type that can build an empty instance of its own concrete type

A message type that can build an empty instance of its own concrete type. Kept apart from `Message` so that `&Message` stays a usable trait object.

pub(open) trait Fresh
fn fresh(Self) -> Self
traitListFieldA repeated field: zero-indexed and ordered.

A repeated field: zero-indexed and ordered.

pub(open) trait ListField
fn length(Self) -> Int32
fn get(Self, Int32) -> Value
fn set(Self, Int32, Value) -> Unit
fn append(Self, Value) -> Unit
fn append_mutable(Self) -> Value
fn truncate(Self, Int32) -> Unit
fn new_element(Self) -> Value
fn is_valid(Self) -> Bool
traitMapFieldA map field: unordered, keyed by one of the six key kinds.

A map field: unordered, keyed by one of the six key kinds.

pub(open) trait MapField
fn length(Self) -> Int32
fn range(Self, (MapKey, Value) -> Bool) -> Unit
fn has(Self, MapKey) -> Bool
fn clear(Self, MapKey) -> Unit
fn get(Self, MapKey) -> Value
fn set(Self, MapKey, Value) -> Unit
fn mutable(Self, MapKey) -> Value
fn new_value(Self) -> Value
fn is_valid(Self) -> Bool
traitMessageA message instance, reachable only through its descriptor.

A message instance, reachable only through its descriptor.

pub(open) trait Message
fn descriptor(Self) -> MessageDescriptor
fn message_type(Self) -> &MessageType
fn is_valid(Self) -> Bool
fn range(Self, (FieldDescriptor, Value) -> Bool) -> Unit
fn range_extensions(Self, (FieldDescriptor, Value) -> Bool) -> Unit
fn has(Self, FieldDescriptor) -> Bool
fn clear(Self, FieldDescriptor) -> Unit
fn get(Self, FieldDescriptor) -> Value
fn set(Self, FieldDescriptor, Value) -> Unit
fn mutable(Self, FieldDescriptor) -> Value
fn new_field(Self, FieldDescriptor) -> Value
fn which_oneof(Self, OneofDescriptor) -> Int32?
fn get_unknown(Self) -> RawFields
fn set_unknown(Self, RawFields) -> Unit
traitMessageTypeA message's concrete type: its descriptor and a constructor.

A message's concrete type: its descriptor and a constructor.

pub(open) trait MessageType
fn new_message(Self) -> &Message
fn zero(Self) -> &Message
fn descriptor(Self) -> MessageDescriptor
fnCardinality::code
pub fn Cardinality::code(Self) -> Int32
fnCardinality::equalStructural equality for scalars; composites compare by identity, because semantic equality is…

Structural equality for scalars; composites compare by identity, because semantic equality is a descriptor-driven walk in `proto.equal`.

pub fn Cardinality::equal(Self, Self) -> Bool
fnCardinality::not_equal
pub fn Cardinality::not_equal(Self, Self) -> Bool
fnCardinality::of
pub fn Cardinality::of(Int32) -> Self?
fnElement::new
pub fn[T] Element::new((T) -> Value, (Value) -> T, () -> T, (T, &Message) -> Unit, Bool) -> Self[T]
fnEnumDescriptor::value_by_nameThe value with `name`, or `None`.

The value with `name`, or `None`.

pub fn EnumDescriptor::value_by_name(Self, String) -> EnumValueDescriptor?
fnEnumDescriptor::value_by_numberThe value with `number`, or `None`.

The value with `number`, or `None`.

pub fn EnumDescriptor::value_by_number(Self, Int32) -> EnumValueDescriptor?
fnFieldDescriptor::is_listWhether the field is repeated and not a map, so its value is a list.

Whether the field is repeated and not a map, so its value is a list.

pub fn FieldDescriptor::is_list(Self) -> Bool
fnFieldDescriptor::is_map_fieldWhether the field is a map, so its value is a map rather than a list.

Whether the field is a map, so its value is a map rather than a list.

pub fn FieldDescriptor::is_map_field(Self) -> Bool
fnFileDescriptor::nameThe file's own name, without directories.

The file's own name, without directories.

pub fn FileDescriptor::name(Self) -> String
fnFileDescriptor::option_ofThe value of one option on `name`, if it was written.

The value of one option on `name`, if it was written.

pub fn FileDescriptor::option_of(Self, String, String) -> String?
fnFileDescriptor::options_ofThe options written on `name` in this file, as (name, value) pairs.

The options written on `name` in this file, as (name, value) pairs.

pub fn FileDescriptor::options_of(Self, String) -> Array[(String, String)]
fnFiles::all
pub fn Files::all(Self) -> Array[FileDescriptor]
fnFiles::find_enum_by_name
pub fn Files::find_enum_by_name(Self, String) -> EnumDescriptor?
fnFiles::find_file_by_path
pub fn Files::find_file_by_path(Self, String) -> FileDescriptor?
fnFiles::find_message_by_name
pub fn Files::find_message_by_name(Self, String) -> MessageDescriptor?
fnFiles::length
pub fn Files::length(Self) -> Int32
fnFiles::new
pub fn Files::new() -> Self
fnFiles::register
pub fn Files::register(Self, FileDescriptor) -> Unit raise Refused
fnKind::code
pub fn Kind::code(Self) -> Int32
fnKind::equalStructural equality for scalars; composites compare by identity, because semantic equality is…

Structural equality for scalars; composites compare by identity, because semantic equality is a descriptor-driven walk in `proto.equal`.

pub fn Kind::equal(Self, Self) -> Bool
fnKind::is_enumWhether the kind is the enum kind.

Whether the kind is the enum kind.

pub fn Kind::is_enum(Self) -> Bool
fnKind::is_messageWhether the kind is a message or a group, and so needs a nested message.

Whether the kind is a message or a group, and so needs a nested message.

pub fn Kind::is_message(Self) -> Bool
fnKind::is_numericWhether the kind is a number, and so packable when repeated.

Whether the kind is a number, and so packable when repeated.

pub fn Kind::is_numeric(Self) -> Bool
fnKind::not_equal
pub fn Kind::not_equal(Self, Self) -> Bool
fnKind::of
pub fn Kind::of(Int32) -> Self?
fnMapKey::boolThe value as a bool; aborts when it is not one.

The value as a bool; aborts when it is not one.

pub fn MapKey::bool(Self) -> Bool
fnMapKey::equalStructural equality for scalars; composites compare by identity, because semantic equality is…

Structural equality for scalars; composites compare by identity, because semantic equality is a descriptor-driven walk in `proto.equal`.

pub fn MapKey::equal(Self, Self) -> Bool
fnMapKey::intThe value as an integer; `Int32` and `Int64` both widen.

The value as an integer; `Int32` and `Int64` both widen.

pub fn MapKey::int(Self) -> Int64
fnMapKey::not_equal
pub fn MapKey::not_equal(Self, Self) -> Bool
fnMapKey::string
pub fn MapKey::string(Self) -> String
fnMapKey::uintThe value as an unsigned integer; `Uint32` and `Uint64` both widen.

The value as an unsigned integer; `Uint32` and `Uint64` both widen.

pub fn MapKey::uint(Self) -> UInt64
fnMapKey::valueA value for a map key.

A value for a map key.

pub fn MapKey::value(Self) -> Value
fnMessageDescriptor::field_by_json_nameThe field whose JSON name is `name`, or `None`.

The field whose JSON name is `name`, or `None`.

pub fn MessageDescriptor::field_by_json_name(Self, String) -> FieldDescriptor?
fnMessageDescriptor::field_by_nameThe field with the proto `name`, or `None`.

The field with the proto `name`, or `None`.

pub fn MessageDescriptor::field_by_name(Self, String) -> FieldDescriptor?
fnMessageDescriptor::field_by_numberThe field with `number`, or `None`.

The field with `number`, or `None`.

pub fn MessageDescriptor::field_by_number(Self, Int32) -> FieldDescriptor?
fnMessageDescriptor::oneof_of_fieldThe oneof that owns `number`, or `None`.

The oneof that owns `number`, or `None`.

pub fn MessageDescriptor::oneof_of_field(Self, Int32) -> OneofDescriptor?
fnRawFields::bytes
pub fn RawFields::bytes(Self) -> Bytes
fnRawFields::from_bytes
pub fn RawFields::from_bytes(Bytes) -> Self
fnRawFields::is_empty
pub fn RawFields::is_empty(Self) -> Bool
fnRawFields::is_valid
pub fn RawFields::is_valid(Self) -> Bool
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fnSyntax::code
pub fn Syntax::code(Self) -> Int32
fnSyntax::equalStructural equality for scalars; composites compare by identity, because semantic equality is…

Structural equality for scalars; composites compare by identity, because semantic equality is a descriptor-driven walk in `proto.equal`.

pub fn Syntax::equal(Self, Self) -> Bool
fnSyntax::not_equal
pub fn Syntax::not_equal(Self, Self) -> Bool
fnSyntax::of
pub fn Syntax::of(Int32) -> Self?
fnTypedList::append
pub fn[T] TypedList::append(Self[T], Value) -> Unit
fnTypedList::append_mutable
pub fn[T] TypedList::append_mutable(Self[T]) -> Value
fnTypedList::get
pub fn[T] TypedList::get(Self[T], Int32) -> Value
fnTypedList::is_valid
pub fn[T] TypedList::is_valid(Self[T]) -> Bool
fnTypedList::length
pub fn[T] TypedList::length(Self[T]) -> Int32
fnTypedList::new_element
pub fn[T] TypedList::new_element(Self[T]) -> Value
fnTypedList::set
pub fn[T] TypedList::set(Self[T], Int32, Value) -> Unit
fnTypedList::truncate
pub fn[T] TypedList::truncate(Self[T], Int32) -> Unit
fnTypedMap::clear
pub fn[K : Hash + Eq, V] TypedMap::clear(Self[K, V], MapKey) -> Unit
fnTypedMap::get
pub fn[K : Hash + Eq, V] TypedMap::get(Self[K, V], MapKey) -> Value
fnTypedMap::has
pub fn[K : Hash + Eq, V] TypedMap::has(Self[K, V], MapKey) -> Bool
fnTypedMap::is_valid
pub fn[K : Hash + Eq, V] TypedMap::is_valid(Self[K, V]) -> Bool
fnTypedMap::length
pub fn[K : Hash + Eq, V] TypedMap::length(Self[K, V]) -> Int32
fnTypedMap::mutable
pub fn[K : Hash + Eq, V] TypedMap::mutable(Self[K, V], MapKey) -> Value
fnTypedMap::new_value
pub fn[K : Hash + Eq, V] TypedMap::new_value(Self[K, V]) -> Value
fnTypedMap::range
pub fn[K : Hash + Eq, V] TypedMap::range(Self[K, V], (MapKey, Value) -> Bool) -> Unit
fnTypedMap::set
pub fn[K : Hash + Eq, V] TypedMap::set(Self[K, V], MapKey, Value) -> Unit
fnTypes::find_enum_by_name
pub fn Types::find_enum_by_name(Self, String) -> &EnumType?
fnTypes::find_extension_by_name
pub fn Types::find_extension_by_name(Self, String) -> &ExtensionType?
fnTypes::find_extension_by_number
pub fn Types::find_extension_by_number(Self, String, Int32) -> &ExtensionType?
fnTypes::find_message_by_name
pub fn Types::find_message_by_name(Self, String) -> &MessageType?
fnTypes::new
pub fn Types::new() -> Self
fnTypes::num_enums
pub fn Types::num_enums(Self) -> Int32
fnTypes::num_extensions
pub fn Types::num_extensions(Self) -> Int32
fnTypes::num_messages
pub fn Types::num_messages(Self) -> Int32
fnTypes::range_enums
pub fn Types::range_enums(Self, (&EnumType) -> Bool) -> Unit
fnTypes::range_extensions
pub fn Types::range_extensions(Self, (&ExtensionType) -> Bool) -> Unit
fnTypes::range_messages
pub fn Types::range_messages(Self, (&MessageType) -> Bool) -> Unit
fnTypes::register_enum
pub fn Types::register_enum(Self, &EnumType) -> Unit raise Refused
fnTypes::register_extension
pub fn Types::register_extension(Self, &ExtensionType) -> Unit raise Refused
fnTypes::register_message
pub fn Types::register_message(Self, &MessageType) -> Unit raise Refused
fnValue::boolThe value as a bool; aborts when it is not one.

The value as a bool; aborts when it is not one.

pub fn Value::bool(Self) -> Bool
fnValue::bytes
pub fn Value::bytes(Self) -> Bytes
fnValue::enum_number
pub fn Value::enum_number(Self) -> Int32
fnValue::equalStructural equality for scalars; composites compare by identity, because semantic equality is…

Structural equality for scalars; composites compare by identity, because semantic equality is a descriptor-driven walk in `proto.equal`.

pub fn Value::equal(Self, Self) -> Bool
fnValue::floatThe value as a double; `Float` widens.

The value as a double; `Float` widens.

pub fn Value::float(Self) -> Double
fnValue::intThe value as an integer; `Int32` and `Int64` both widen.

The value as an integer; `Int32` and `Int64` both widen.

pub fn Value::int(Self) -> Int64
fnValue::is_valid
pub fn Value::is_valid(Self) -> Bool
fnValue::list
pub fn Value::list(Self) -> &ListField
fnValue::map
pub fn Value::map(Self) -> &MapField
fnValue::map_keyThe value as a map key, or `None` when its kind cannot be a key.

The value as a map key, or `None` when its kind cannot be a key.

pub fn Value::map_key(Self) -> MapKey?
fnValue::message
pub fn Value::message(Self) -> &Message
fnValue::string
pub fn Value::string(Self) -> String
fnValue::uintThe value as an unsigned integer; `Uint32` and `Uint64` both widen.

The value as an unsigned integer; `Uint32` and `Uint64` both widen.

pub fn Value::uint(Self) -> UInt64
fnValueList::append
pub fn ValueList::append(Self, Value) -> Unit
fnValueList::append_mutable
pub fn ValueList::append_mutable(Self) -> Value
fnValueList::from_array
pub fn ValueList::from_array(FieldDescriptor, Array[Value]) -> Self
fnValueList::get
pub fn ValueList::get(Self, Int32) -> Value
fnValueList::is_valid
pub fn ValueList::is_valid(Self) -> Bool
fnValueList::length
pub fn ValueList::length(Self) -> Int32
fnValueList::new
pub fn ValueList::new(FieldDescriptor) -> Self
fnValueList::new_element
pub fn ValueList::new_element(Self) -> Value
fnValueList::set
pub fn ValueList::set(Self, Int32, Value) -> Unit
fnValueList::truncate
pub fn ValueList::truncate(Self, Int32) -> Unit
fnValueMap::clear
pub fn ValueMap::clear(Self, MapKey) -> Unit
fnValueMap::get
pub fn ValueMap::get(Self, MapKey) -> Value
fnValueMap::has
pub fn ValueMap::has(Self, MapKey) -> Bool
fnValueMap::is_valid
pub fn ValueMap::is_valid(Self) -> Bool
fnValueMap::length
pub fn ValueMap::length(Self) -> Int32
fnValueMap::mutable
pub fn ValueMap::mutable(Self, MapKey) -> Value
fnValueMap::new
pub fn ValueMap::new(FieldDescriptor) -> Self
fnValueMap::new_value
pub fn ValueMap::new_value(Self) -> Value
fnValueMap::range
pub fn ValueMap::range(Self, (MapKey, Value) -> Bool) -> Unit
fnValueMap::set
pub fn ValueMap::set(Self, MapKey, Value) -> Unit
fnassign_list
pub fn[T] assign_list(Array[T], &ListField, Element[T]) -> Unit
fnassign_map
pub fn[K : Hash + Eq, V] assign_map(Map[K, V], &MapField, (MapKey) -> K, Element[V]) -> Unit
fndefault_forThe value `get` returns for a field that is unset: the declared default when there is one, th…

The value `get` returns for a field that is unset: the declared default when there is one, the kind's zero otherwise.

pub fn default_for(FieldDescriptor) -> Value
fnfloat_valueA 32-bit float carried as the double the wire and the encoders use.

A 32-bit float carried as the double the wire and the encoders use.

pub fn float_value(Double) -> Value
fnis_set
pub fn[T] is_set(T?) -> Bool
fnlist_view
pub fn[T] list_view(Array[T], Element[T]) -> &ListField
fnmap_view
pub fn[K : Hash + Eq, V] map_view(Map[K, V], (K) -> MapKey, (MapKey) -> K, Element[V]) -> &MapField
fnmessage_element
pub fn[T] message_element((T) -> Value, () -> T, (T, &Message) -> Unit) -> Element[T]
fnmissing_requiredThe dotted path of the first required field that has no value, or `None` when the message and…

The dotted path of the first required field that has no value, or `None` when the message and its nested messages are complete. The encoders use this so each can report the omission in its own error type.

pub fn missing_required(&Message) -> String?
fnnew_element_valueA fresh value for an element of a list or map.

A fresh value for an element of a list or map.

pub fn new_element_value(Kind, String?) -> Value
fnnew_field_valueA fresh, mutable value assignable to `field`: an empty list, an empty map, a new message, or…

A fresh, mutable value assignable to `field`: an empty list, an empty map, a new message, or the scalar default.

pub fn new_field_value(FieldDescriptor) -> Value
fnparent_nameThe qualified name with its last segment removed.

The qualified name with its last segment removed.

pub fn parent_name(String) -> String
fnqualifyA qualified name built from a package and a short name.

A qualified name built from a package and a short name.

pub fn qualify(String, String) -> String
fnscalar_element
pub fn[T] scalar_element((T) -> Value, (Value) -> T, () -> T) -> Element[T]
fnshort_nameThe last segment of a qualified name.

The last segment of a qualified name.

pub fn short_name(String) -> String
fnzero_valueThe zero value for a scalar kind; `Invalid` for a message or group, which has no scalar zero.

The zero value for a scalar kind; `Invalid` for a message or group, which has no scalar zero.

pub fn zero_value(Kind) -> Value
letglobal_filesThe process-wide registries a generated file registers into.

The process-wide registries a generated file registers into.

pub let global_files : Files
letglobal_types
pub let global_types : Types
letinvalidThe empty value, used where a field is absent and a `Value` is still required.

The empty value, used where a field is absent and a `Value` is still required.

pub let invalid : Value

proto

moonbitstack/moonproto/proto

Binary encoding and decoding, size, merge, clone, equal, reset.

structMarshalOptionsHow a message is encoded.

How a message is encoded.

pub(all) struct MarshalOptions
allow_partial : Bool
deterministic : Bool
structUnmarshalOptionsHow a message is decoded.

How a message is decoded.

pub(all) struct UnmarshalOptions
merge : Bool
allow_partial : Bool
discard_unknown : Bool
recursion_limit : Int32
suberrorRefusedA binary refusal.

A binary refusal.

pub(all) suberror Refused
Wire(@wire.Refused)
Required(String)
NoType(String)
Recursion(Int32)
Mismatch(String)
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fncheck_initialized
pub fn[M : @reflect.Message] check_initialized(M) -> Unit raise Refused
fnclear_extension
pub fn[M : @reflect.Message] clear_extension(M, &@reflect.ExtensionType) -> Unit
fnclone
pub fn[M : @reflect.Message + @reflect.Fresh] clone(M) -> M
fndecode
pub fn[M : @reflect.Message] decode(BytesView, M, unmarshal_options? : UnmarshalOptions) -> Unit raise Refused
fnencode
pub fn[M : @reflect.Message] encode(M, marshal_options? : MarshalOptions) -> Bytes raise Refused
fnencode_to
pub fn[M : @reflect.Message] encode_to(@buffer.Buffer, M, marshal_options? : MarshalOptions) -> Unit raise Refused
fnequal
pub fn[M : @reflect.Message] equal(M, M) -> Bool
fnget_extension
pub fn[M : @reflect.Message] get_extension(M, &@reflect.ExtensionType) -> @reflect.Value?
fnhas_extension
pub fn[M : @reflect.Message] has_extension(M, &@reflect.ExtensionType) -> Bool
fnmerge
pub fn[M : @reflect.Message] merge(M, &@reflect.Message) -> Unit
fnrange_extensions
pub fn[M : @reflect.Message] range_extensions(M, (&@reflect.ExtensionType, @reflect.Value) -> Bool) -> Unit
fnreset
pub fn[M : @reflect.Message] reset(M) -> Unit
fnset_extension
pub fn[M : @reflect.Message] set_extension(M, &@reflect.ExtensionType, @reflect.Value) -> Unit
fnsize
pub fn[M : @reflect.Message] size(M) -> Int32
letmarshal_options
pub let marshal_options : MarshalOptions
letunmarshal_options
pub let unmarshal_options : UnmarshalOptions

json

moonbitstack/moonproto/json

The JSON mapping, including the well-known type forms.

structMarshalOptionsHow a message is written as JSON.

How a message is written as JSON.

pub(all) struct MarshalOptions
multiline : Bool
indent : String
allow_partial : Bool
use_proto_names : Bool
use_enum_numbers : Bool
emit_unpopulated : Bool
emit_default_values : Bool
structUnmarshalOptionsHow a message is read from JSON.

How a message is read from JSON.

pub(all) struct UnmarshalOptions
allow_partial : Bool
discard_unknown : Bool
recursion_limit : Int32
suberrorRefusedA JSON refusal.

A JSON refusal.

pub(all) suberror Refused
Syntax(String)
UnknownField(String)
BadValue(String)
BadBase64(String)
Recursion(Int32)
NoType(String)
Required(String)
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fndecode
pub fn[M : @reflect.Message] decode(StringView, M, unmarshal_options? : UnmarshalOptions) -> Unit raise Refused
fnencode
pub fn[M : @reflect.Message] encode(M, marshal_options? : MarshalOptions) -> String raise Refused
fnfrom_json
pub fn[M : @reflect.Message] from_json(M, @moonbitlang/core/json.Json, unmarshal_options? : UnmarshalOptions) -> Unit raise Refused
fnto_json
pub fn[M : @reflect.Message] to_json(M, marshal_options? : MarshalOptions) -> @moonbitlang/core/json.Json raise Refused
letmarshal_options
pub let marshal_options : MarshalOptions
letunmarshal_options
pub let unmarshal_options : UnmarshalOptions

text

moonbitstack/moonproto/text

The text format: fields, groups, lists and every literal.

structMarshalOptions
pub(all) struct MarshalOptions
multiline : Bool
indent : String
emit_ascii : Bool
allow_partial : Bool
structUnmarshalOptions
pub(all) struct UnmarshalOptions
allow_partial : Bool
discard_unknown : Bool
recursion_limit : Int32
suberrorRefusedA text-format refusal.

A text-format refusal.

pub(all) suberror Refused
Syntax(String, Int32)
UnknownField(String)
BadValue(String)
NoType(String)
Required(String)
Recursion(Int32)
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fndecode
pub fn[M : @reflect.Message] decode(StringView, M, unmarshal_options? : UnmarshalOptions) -> Unit raise Refused
fnencode
pub fn[M : @reflect.Message] encode(M, marshal_options? : MarshalOptions) -> String raise Refused
letmarshal_options
pub let marshal_options : MarshalOptions
letunmarshal_options
pub let unmarshal_options : UnmarshalOptions

delim

moonbitstack/moonproto/delim

Varint size-delimited messages over a byte source.

structBytesReaderA reader over a fixed byte sequence.

A reader over a fixed byte sequence.

pub struct BytesReader
bytes : Bytes
mut pos : Int32
structBytesWriterA writer that collects into a buffer, for callers that already hold bytes.

A writer that collects into a buffer, for callers that already hold bytes.

pub struct BytesWriter
buf : @buffer.Buffer
structMarshalOptions
pub(all) struct MarshalOptions
marshal : @proto.MarshalOptions
structUnmarshalOptions
pub(all) struct UnmarshalOptions
unmarshal : @proto.UnmarshalOptions
max_size : Int32
suberrorRefused
pub(all) suberror Refused
Wire(@wire.Refused)
Proto(@proto.Refused)
Size(Int32, Int32)
Truncated
traitReader
pub(open) trait Reader
fn read_byte(Self) -> Int32?
traitWriter
pub(open) trait Writer
fn write(Self, BytesView) -> Unit raise Refused
fnBytesReader::new
pub fn BytesReader::new(Bytes) -> Self
fnBytesReader::read_byte
pub fn BytesReader::read_byte(Self) -> Int32?
fnBytesWriter::new
pub fn BytesWriter::new() -> Self
fnBytesWriter::to_bytes
pub fn BytesWriter::to_bytes(Self) -> Bytes
fnBytesWriter::write
pub fn BytesWriter::write(Self, BytesView) -> Unit raise Refused
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fndecode_from
pub fn[M : @reflect.Message] decode_from(&Reader, M, unmarshal_options? : UnmarshalOptions) -> Unit raise Refused
fnencode_to
pub fn[M : @reflect.Message] encode_to(&Writer, M, marshal_options? : MarshalOptions) -> Int32 raise Refused
letmarshal_options
pub let marshal_options : MarshalOptions
letunmarshal_options
pub let unmarshal_options : UnmarshalOptions

dynamic

moonbitstack/moonproto/dynamic

Messages, enums and extensions built from descriptors at run time.

structEnumType
pub struct EnumType
desc : @reflect.EnumDescriptor
structEnumValueAn enum value carrying its descriptor and number.

An enum value carrying its descriptor and number.

pub struct EnumValue
desc : @reflect.EnumDescriptor
enum_type : &@reflect.EnumType
number_value : Int32
structExtensionTypeAn extension type backed by its descriptor.

An extension type backed by its descriptor.

pub struct ExtensionType
desc : @reflect.FieldDescriptor
structMessage
pub struct Message
desc : @reflect.MessageDescriptor
msg_type : &@reflect.MessageType
fields : Array[(Int32, @reflect.Value)]
mut unknown : Bytes
ext_fields : Array[@reflect.FieldDescriptor]
structMessageTypeThe type of a dynamic message: its descriptor and a constructor.

The type of a dynamic message: its descriptor and a constructor.

pub struct MessageType
desc : @reflect.MessageDescriptor
fnEnumType::descriptor
pub fn EnumType::descriptor(Self) -> @reflect.EnumDescriptor
fnEnumType::new
pub fn EnumType::new(@reflect.EnumDescriptor) -> Self
fnEnumType::new_enum
pub fn EnumType::new_enum(Self, Int32) -> &@reflect.Enum
fnEnumValue::descriptor
pub fn EnumValue::descriptor(Self) -> @reflect.EnumDescriptor
fnEnumValue::enum_type
pub fn EnumValue::enum_type(Self) -> &@reflect.EnumType
fnEnumValue::number
pub fn EnumValue::number(Self) -> Int32
fnExtensionType::descriptor
pub fn ExtensionType::descriptor(Self) -> @reflect.FieldDescriptor
fnExtensionType::is_valid_value
pub fn ExtensionType::is_valid_value(Self, @reflect.Value) -> Bool
fnExtensionType::new_value
pub fn ExtensionType::new_value(Self) -> @reflect.Value
fnExtensionType::zero
pub fn ExtensionType::zero(Self) -> @reflect.Value
fnMessage::clear
pub fn Message::clear(Self, @reflect.FieldDescriptor) -> Unit
fnMessage::descriptor
pub fn Message::descriptor(Self) -> @reflect.MessageDescriptor
fnMessage::fresh
pub fn Message::fresh(Self) -> Self
fnMessage::get
pub fn Message::get(Self, @reflect.FieldDescriptor) -> @reflect.Value
fnMessage::get_unknown
pub fn Message::get_unknown(Self) -> @reflect.RawFields
fnMessage::has
pub fn Message::has(Self, @reflect.FieldDescriptor) -> Bool
fnMessage::is_valid
pub fn Message::is_valid(Self) -> Bool
fnMessage::message_type
pub fn Message::message_type(Self) -> &@reflect.MessageType
fnMessage::mutable
pub fn Message::mutable(Self, @reflect.FieldDescriptor) -> @reflect.Value
fnMessage::new
pub fn Message::new(@reflect.MessageDescriptor) -> Self
fnMessage::new_field
pub fn Message::new_field(Self, @reflect.FieldDescriptor) -> @reflect.Value
fnMessage::new_with_type
pub fn Message::new_with_type(@reflect.MessageDescriptor, &@reflect.MessageType) -> Self
fnMessage::range
pub fn Message::range(Self, (@reflect.FieldDescriptor, @reflect.Value) -> Bool) -> Unit
fnMessage::range_extensions
pub fn Message::range_extensions(Self, (@reflect.FieldDescriptor, @reflect.Value) -> Bool) -> Unit
fnMessage::set
pub fn Message::set(Self, @reflect.FieldDescriptor, @reflect.Value) -> Unit
fnMessage::set_unknown
pub fn Message::set_unknown(Self, @reflect.RawFields) -> Unit
fnMessage::which_oneof
pub fn Message::which_oneof(Self, @reflect.OneofDescriptor) -> Int32?
fnMessageType::descriptor
pub fn MessageType::descriptor(Self) -> @reflect.MessageDescriptor
fnMessageType::new
pub fn MessageType::new(@reflect.MessageDescriptor) -> Self
fnMessageType::new_message
pub fn MessageType::new_message(Self) -> &@reflect.Message
fnMessageType::zero
pub fn MessageType::zero(Self) -> &@reflect.Message
fnnew_enum_type
pub fn new_enum_type(@reflect.EnumDescriptor) -> &@reflect.EnumType
fnnew_extension_type
pub fn new_extension_type(@reflect.FieldDescriptor) -> &@reflect.ExtensionType
fnnew_message_type
pub fn new_message_type(@reflect.MessageDescriptor) -> &@reflect.MessageType

desc

moonbitstack/moonproto/desc

Building runtime descriptors, and converting them back.

structDescriptorProto
pub(all) struct DescriptorProto
name : String
field : Array[FieldDescriptorProto]
nested_type : Array[DescriptorProto]
enum_type : Array[EnumDescriptorProto]
extension : Array[FieldDescriptorProto]
oneof_decl : Array[OneofDescriptorProto]
reserved_range : Array[(Int32, Int32)]
reserved_name : Array[String]
extension_range : Array[(Int32, Int32)]
map_entry : Bool
features : Features
options : Array[(String, String)]
structEnumDescriptorProto
pub(all) struct EnumDescriptorProto
name : String
value : Array[EnumValueDescriptorProto]
features : Features
options : Array[(String, String)]
structEnumValueDescriptorProto
pub(all) struct EnumValueDescriptorProto
name : String
number : Int32
structFeaturesThe edition feature values that change how a declaration is interpreted

The edition feature values that change how a declaration is interpreted. Zero means "inherit", which is what proto2 and proto3 files use.

pub(all) struct Features
field_presence : Int32
enum_type : Int32
repeated_field_encoding : Int32
message_encoding : Int32
utf8_validation : Int32
json_format : Int32
structFieldDescriptorProto
pub(all) struct FieldDescriptorProto
name : String
number : Int32
label : Int32
type_code : Int32
type_name : String?
json_name : String?
default_value : String?
oneof_index : Int32?
proto3_optional : Bool
packed_off : Bool
extendee : String?
features : Features
options : Array[(String, String)]
structFileDescriptorProto
pub(all) struct FileDescriptorProto
name : String
package_name : String
syntax : String
message_type : Array[DescriptorProto]
enum_type : Array[EnumDescriptorProto]
service : Array[ServiceDescriptorProto]
extension : Array[FieldDescriptorProto]
dependency : Array[String]
public_dependency : Array[Int32]
edition : String?
features : Features
options : Array[(String, String)]
structMethodDescriptorProto
pub(all) struct MethodDescriptorProto
name : String
input_type : String
output_type : String
client_streaming : Bool
server_streaming : Bool
structOneofDescriptorProto
pub(all) struct OneofDescriptorProto
name : String
structServiceDescriptorProto
pub(all) struct ServiceDescriptorProto
name : String
methods : Array[MethodDescriptorProto]
suberrorRefusedA build refusal.

A build refusal.

pub(all) suberror Refused
Name(String)
Number(Int32)
Type(String)
Syntax(String)
fnFeatures::mergeA child's features on top of its parent's: anything the child sets wins, anything it leaves a…

A child's features on top of its parent's: anything the child sets wins, anything it leaves at zero is inherited.

pub fn Features::merge(Self, Self) -> Self
fnFeatures::setSet one `features.<name>` value, leaving the name alone when it is not a feature

Set one `features.<name>` value, leaving the name alone when it is not a feature. `value` is the identifier or boolean as written.

pub fn Features::set(Self, String, String) -> Self
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fnbuild_fileBuild a runtime file descriptor from the proto form.

Build a runtime file descriptor from the proto form.

pub fn build_file(FileDescriptorProto) -> @reflect.FileDescriptor raise Refused
fnto_file_descriptor_protoThe proto form of a runtime file descriptor.

The proto form of a runtime file descriptor.

pub fn to_file_descriptor_proto(@reflect.FileDescriptor) -> FileDescriptorProto
fnto_json_name`foo_bar` becomes `fooBar`, the JSON name default.

`foo_bar` becomes `fooBar`, the JSON name default.

pub fn to_json_name(String) -> String
letfeatures_auto
pub let features_auto : Features

parser

moonbitstack/moonproto/parser

The .proto language: proto2, proto3 and editions.

suberrorRefused
pub(all) suberror Refused
Syntax(String, Int32)
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fnparseParse one `.proto` file.

Parse one `.proto` file.

pub fn parse(String, String) -> @desc.FileDescriptorProto raise Refused

gen

moonbitstack/moonproto/gen

The protoc plugin protocol and the MoonBit code generator.

structNamingHow one generated file names the types it refers to: bare when they live in the same package,…

How one generated file names the types it refers to: bare when they live in the same package, qualified by an prefix when they do not.

pub struct Naming
dir : String
symbols : Symbols
imports : Array[(String, String)]
structRequestOne request to generate code.

One request to generate code.

pub(all) struct Request
files_to_generate : Array[String]
parameter : String
proto_file : Array[@desc.FileDescriptorProto]
structSymbolsFully-qualified proto name to generated type.

Fully-qualified proto name to generated type.

pub struct Symbols
types : Map[String, TypeRef]
structTypeRefWhere a generated type lives: the package directory its file lands in, and the type name insi…

Where a generated type lives: the package directory its file lands in, and the type name inside it.

pub(all) struct TypeRef
dir : String
name : String
suberrorRefused
pub(all) suberror Refused
Protocol(String)
Proto(@proto.Refused)
Desc(@desc.Refused)
Unknown(String)
fnNaming::new
pub fn Naming::new(String, Symbols) -> Self
fnRefused::output
pub fn Refused::output(Self, &Logger) -> Unit
fnRefused::to_string
pub fn Refused::to_string(Self) -> String
fnSymbols::add_fileRecord every message and enum one file declares, including the nested ones

Record every message and enum one file declares, including the nested ones. A map entry is recorded too: a field that names it is a map, and the field's emitter asks for the entry's value type by name.

pub fn Symbols::add_file(Self, @desc.FileDescriptorProto) -> Unit
fnSymbols::new
pub fn Symbols::new() -> Self
fndecode_requestDecode a `CodeGeneratorRequest`.

Decode a `CodeGeneratorRequest`.

pub fn decode_request(Bytes) -> Request raise Refused
fndecode_responseDecode a response: the generated files and the error, if any.

Decode a response: the generated files and the error, if any.

pub fn decode_response(Bytes) -> (Array[(String, String)], String?) raise Refused
fnemit_messageEmit one message: the struct, its constructor, its accessors, its oneofs and its reflective i…

Emit one message: the struct, its constructor, its accessors, its oneofs and its reflective implementation.

pub fn emit_message(@reflect.MessageDescriptor, String, String, Naming, @buffer.Buffer) -> Unit raise Refused
fnencode_requestEncode a request, the inverse of `decode_request`.

Encode a request, the inverse of `decode_request`.

pub fn encode_request(Request) -> Bytes raise Refused
fnencode_responseEncode a `CodeGeneratorResponse`.

Encode a `CodeGeneratorResponse`.

pub fn encode_response(Array[(String, String)], String?) -> Bytes raise Refused
fngenerate_sourceGenerate the MoonBit source for one file descriptor, resolving the types the file refers to a…

Generate the MoonBit source for one file descriptor, resolving the types the file refers to against its own declarations only.

pub fn generate_source(@desc.FileDescriptorProto) -> String raise Refused
fngenerate_source_withGenerate one file, resolving the types it refers to against every file of the request, so a r…

Generate one file, resolving the types it refers to against every file of the request, so a reference to another file's message names the right type.

pub fn generate_source_with(@desc.FileDescriptorProto, Symbols) -> String raise Refused
fnplugin_mainThe protoc plugin entry point: a serialized request in, a serialized response out.

The protoc plugin entry point: a serialized request in, a serialized response out.

pub fn plugin_main(Bytes) -> Bytes
fntypesThe two files the protocol needs, built once.

The two files the protocol needs, built once.

pub fn types() -> @reflect.Types
letplugin_types
pub let plugin_types : @reflect.Types

known

moonbitstack/moonproto/known

The well-known types, generated from the schemas protobuf ships.

fndescriptor_file`descriptor.proto`, which carries the descriptor messages themselves.

`descriptor.proto`, which carries the descriptor messages themselves.

pub fn descriptor_file() -> @reflect.FileDescriptor raise @desc.Refused
fnfile_descriptorThe first file that declares `name`, or the descriptor file.

The first file that declares `name`, or the descriptor file.

pub fn file_descriptor() -> @reflect.FileDescriptor raise @desc.Refused
fnfilesEvery well-known file, in the order protobuf lists them.

Every well-known file, in the order protobuf lists them.

pub fn files() -> Array[@reflect.FileDescriptor] raise @desc.Refused
fnmessage_descriptorLook a message up by its qualified name.

Look a message up by its qualified name.

pub fn message_descriptor(String) -> @reflect.MessageDescriptor? raise @desc.Refused
fnregister_allRegister every well-known type, so the codecs can resolve a message by name

Register every well-known type, so the codecs can resolve a message by name. Registering twice is harmless.

pub fn register_all() -> Unit

conformance

moonbitstack/moonproto/conformance

The conformance protocol: read one format, write another.

fnhandleAnswer one request: read the payload in the format it carries, write it in the requested one.

Answer one request: read the payload in the format it carries, write it in the requested one.

pub fn handle(Bytes) -> Bytes
fnofficial_files
pub fn official_files() -> Array[@desc.FileDescriptorProto]
fnregister_known_typesRegister the well-known types too, so a request that names one resolves.

Register the well-known types too, so a request that names one resolves.

pub fn register_known_types() -> Unit
fnregister_official_typesRegister the message types the official runner names: proto2, proto3, editions and edition-un…

Register the message types the official runner names: proto2, proto3, editions and edition-unstable test schemas. Their descriptors come from the pinned descriptor set, so the testee has no build-time dependency on protoc.

pub fn register_official_types() -> Unit
fnregister_test_types
pub fn register_test_types() -> Unit
fntest_descriptorA message that exercises every scalar kind, a packed repeat, a map, a nested message, an enum…

A message that exercises every scalar kind, a packed repeat, a map, a nested message, an enum and a oneof.

pub fn test_descriptor() -> @desc.FileDescriptorProto