package ocaml-protoc

  1. Overview
  2. Docs

OCaml type representation

type payload_kind =
  1. | Pk_varint of bool
    (*

    zigzag

    *)
  2. | Pk_bits32
  3. | Pk_bits64
  4. | Pk_bytes
type user_defined_type = {
  1. udt_module_prefix : string option;
  2. udt_type_name : string;
  3. udt_type : [ `Message | `Enum ];
}
type basic_type =
  1. | Bt_string
  2. | Bt_float
  3. | Bt_int
  4. | Bt_int32
  5. | Bt_uint32
  6. | Bt_int64
  7. | Bt_uint64
  8. | Bt_bytes
  9. | Bt_bool
type wrapper_type = {
  1. wt_type : basic_type;
  2. wt_pk : payload_kind;
}
type field_type =
  1. | Ft_unit
  2. | Ft_basic_type of basic_type
  3. | Ft_user_defined_type of user_defined_type
  4. | Ft_wrapper_type of wrapper_type
type default_value = Pb_option.constant option
type associative_type =
  1. | At_list
  2. | At_hashtable
type repeated_type =
  1. | Rt_list
  2. | Rt_repeated_field
type encoding_number = int
type is_packed = bool
type record_field_type =
  1. | Rft_nolabel of field_type * encoding_number * payload_kind
  2. | Rft_required of field_type * encoding_number * payload_kind * default_value
  3. | Rft_optional of field_type * encoding_number * payload_kind * default_value
  4. | Rft_repeated of repeated_type * field_type * encoding_number * payload_kind * is_packed
  5. | Rft_associative of associative_type * encoding_number * (basic_type * payload_kind) * (field_type * payload_kind)
  6. | Rft_variant of variant
and variant_constructor = {
  1. vc_constructor : string;
  2. vc_field_type : variant_constructor_type;
  3. vc_encoding_number : encoding_number;
  4. vc_payload_kind : payload_kind;
}
and variant_constructor_type =
  1. | Vct_nullary
  2. | Vct_non_nullary_constructor of field_type
and variant = {
  1. v_name : string;
  2. v_constructors : variant_constructor list;
}
and record_field = {
  1. rf_label : string;
  2. rf_field_type : record_field_type;
  3. rf_mutable : bool;
}
and record = {
  1. r_name : string;
  2. r_fields : record_field list;
}
and const_variant_constructor = {
  1. cvc_name : string;
  2. cvc_binary_value : int;
  3. cvc_string_value : string;
}
and const_variant = {
  1. cv_name : string;
  2. cv_constructors : const_variant_constructor list;
}
and type_spec =
  1. | Record of record
  2. | Variant of variant
  3. | Const_variant of const_variant
type type_ = {
  1. module_prefix : string;
    (*

    code generation leads to several file/module being generated for a given type_. module_prefix is the common prefix for all those generated module and it is based on the `.proto` filename.

    *)
  2. spec : type_spec;
  3. type_level_ppx_extension : string option;
}
OCaml

Innovation. Community. Security.