-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from mransan/proto3-optional
Proto3 optional
- Loading branch information
Showing
6 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ ocaml_protoc.native | |
.merlin | ||
|
||
*.orig | ||
_opam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(env | ||
(_ | ||
(flags -bin-annot -annot -safe-string -strict-sequence | ||
-keep-locs -no-alias-deps -w A-4-42-41-48-70))) | ||
(flags -bin-annot -annot -strict-sequence -keep-locs -no-alias-deps -w | ||
A-4-42-41-48-70))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
open Test_proto3_optional_types | ||
open Test_proto3_optional_pp | ||
module Pb = Test_proto3_optional_pb | ||
|
||
let foo1: foo = { | ||
x=1l; | ||
y=None; | ||
name=Some "hello"; | ||
} | ||
|
||
let () = | ||
let enc = Pbrt.Encoder.create() in | ||
Pb.encode_foo foo1 enc ; | ||
let s = Pbrt.Encoder.to_string enc in | ||
let dec = Pbrt.Decoder.of_string s in | ||
let foo1' = Pb.decode_foo dec in | ||
assert (foo1 = foo1') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
syntax="proto3"; | ||
|
||
message Foo { | ||
int32 x = 1; | ||
optional int32 y = 2; | ||
optional string name = 3; | ||
} | ||
|