Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
55 lines
1.3 KiB
1 year ago
|
// Protocol Buffers - Google's data interchange format
|
||
|
// Copyright 2023 Google LLC. All rights reserved.
|
||
|
//
|
||
1 year ago
|
// Use of this source code is governed by a BSD-style
|
||
|
// license that can be found in the LICENSE file or at
|
||
|
// https://developers.google.com/open-source/licenses/bsd
|
||
1 year ago
|
|
||
11 months ago
|
// LINT: LEGACY_NAMES
|
||
7 months ago
|
|
||
|
// The purpose of this file is to be hostile on field/message/enum naming and
|
||
|
// ensure that it works (e.g. collisions between names and language keywords,
|
||
|
// collisions between two different field's accessor's names).
|
||
11 months ago
|
|
||
1 year ago
|
syntax = "proto2";
|
||
|
|
||
11 months ago
|
// Note: Ideally this test could be 'package type.if.else.true.false'
|
||
|
// which would work in Rust but would break the C++ codegen.
|
||
|
|
||
|
package type.type;
|
||
1 year ago
|
|
||
11 months ago
|
message Self {
|
||
|
optional int32 for = 1;
|
||
|
optional Self self = 2;
|
||
|
optional bool true = 3;
|
||
|
optional string false = 4;
|
||
|
}
|
||
|
|
||
9 months ago
|
message Pub {
|
||
11 months ago
|
enum Self {
|
||
|
enum = 0;
|
||
|
}
|
||
|
}
|
||
1 year ago
|
|
||
9 months ago
|
message enum {}
|
||
|
|
||
|
message Ref {
|
||
11 months ago
|
oneof self {
|
||
9 months ago
|
.type.type.Pub.Self const = 3;
|
||
11 months ago
|
}
|
||
1 year ago
|
}
|
||
7 months ago
|
|
||
|
// A message where the accessors would collide that should still work. Note that
|
||
|
// not all collisions problems are avoided, not least because C++ Proto does not
|
||
|
// avoid all possible collisions (eg a field `x` and `clear_x` will often not
|
||
|
// compile on C++).
|
||
|
message AccessorsCollide {
|
||
|
message X {}
|
||
|
message SetX {}
|
||
|
optional SetX set_x = 2;
|
||
|
optional X x = 3;
|
||
|
oneof o {
|
||
|
bool x_mut = 5;
|
||
|
}
|
||
|
}
|