mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 16:26:10 +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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user