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:
Casper
2021-08-18 15:37:44 -04:00
committed by GitHub
parent 4a0879458d
commit 273f6084e5
13 changed files with 675 additions and 18 deletions

View File

@@ -22,14 +22,14 @@ public class KeywordsInUnionUnion {
public T As<T>() where T : class { return this.Value as T; }
public KeywordsInTableT Asstatic() { return this.As<KeywordsInTableT>(); }
public static KeywordsInUnionUnion Fromstatic(KeywordsInTableT _static) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.static_, Value = _static }; }
public string Asinternal() { return this.As<string>(); }
public static KeywordsInUnionUnion Frominternal(string _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.internal_, Value = _internal }; }
public KeywordsInTableT Asinternal() { return this.As<KeywordsInTableT>(); }
public static KeywordsInUnionUnion Frominternal(KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.internal_, Value = _internal }; }
public static int Pack(FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
switch (_o.Type) {
default: return 0;
case KeywordsInUnion.static_: return KeywordsInTable.Pack(builder, _o.Asstatic()).Value;
case KeywordsInUnion.internal_: return builder.CreateString(_o.Asinternal()).Value;
case KeywordsInUnion.internal_: return KeywordsInTable.Pack(builder, _o.Asinternal()).Value;
}
}
}
@@ -70,7 +70,7 @@ public class KeywordsInUnionUnion_JsonConverter : Newtonsoft.Json.JsonConverter
switch (_o.Type) {
default: break;
case KeywordsInUnion.static_: _o.Value = serializer.Deserialize<KeywordsInTableT>(reader); break;
case KeywordsInUnion.internal_: _o.Value = serializer.Deserialize<string>(reader); break;
case KeywordsInUnion.internal_: _o.Value = serializer.Deserialize<KeywordsInTableT>(reader); break;
}
return _o;
}