mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 15:35:06 +00:00
Fix Rust keyword inconsistency (#6794)
* Make Rust keyword escaping more consistent * fix comment * git clang format Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -20,19 +20,24 @@ public struct KeywordsInTable : IFlatbufferObject
|
||||
public bool MutateIs(ABC is_) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, (int)is_); return true; } else { return false; } }
|
||||
public public_ Private { get { int o = __p.__offset(6); return o != 0 ? (public_)__p.bb.GetInt(o + __p.bb_pos) : public_.NONE; } }
|
||||
public bool MutatePrivate(public_ private_) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, (int)private_); return true; } else { return false; } }
|
||||
public int Type { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
public bool MutateType(int type) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, type); return true; } else { return false; } }
|
||||
|
||||
public static Offset<KeywordsInTable> CreateKeywordsInTable(FlatBufferBuilder builder,
|
||||
ABC is_ = ABC.void_,
|
||||
public_ private_ = public_.NONE) {
|
||||
builder.StartTable(2);
|
||||
public_ private_ = public_.NONE,
|
||||
int type = 0) {
|
||||
builder.StartTable(3);
|
||||
KeywordsInTable.AddType(builder, type);
|
||||
KeywordsInTable.AddPrivate(builder, private_);
|
||||
KeywordsInTable.AddIs(builder, is_);
|
||||
return KeywordsInTable.EndKeywordsInTable(builder);
|
||||
}
|
||||
|
||||
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(2); }
|
||||
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(3); }
|
||||
public static void AddIs(FlatBufferBuilder builder, ABC is_) { builder.AddInt(0, (int)is_, 0); }
|
||||
public static void AddPrivate(FlatBufferBuilder builder, public_ private_) { builder.AddInt(1, (int)private_, 0); }
|
||||
public static void AddType(FlatBufferBuilder builder, int type) { builder.AddInt(2, type, 0); }
|
||||
public static Offset<KeywordsInTable> EndKeywordsInTable(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<KeywordsInTable>(o);
|
||||
@@ -45,13 +50,15 @@ public struct KeywordsInTable : IFlatbufferObject
|
||||
public void UnPackTo(KeywordsInTableT _o) {
|
||||
_o.Is = this.Is;
|
||||
_o.Private = this.Private;
|
||||
_o.Type = this.Type;
|
||||
}
|
||||
public static Offset<KeywordsInTable> Pack(FlatBufferBuilder builder, KeywordsInTableT _o) {
|
||||
if (_o == null) return default(Offset<KeywordsInTable>);
|
||||
return CreateKeywordsInTable(
|
||||
builder,
|
||||
_o.Is,
|
||||
_o.Private);
|
||||
_o.Private,
|
||||
_o.Type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +68,13 @@ public class KeywordsInTableT
|
||||
public ABC Is { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("private")]
|
||||
public public_ Private { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
public KeywordsInTableT() {
|
||||
this.Is = ABC.void_;
|
||||
this.Private = public_.NONE;
|
||||
this.Type = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user